Applets
historycombobox.cpp
Go to the documentation of this file.00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021 #include "historycombobox.h"
00022
00023 #include <KHistoryComboBox>
00024
00025
00026 namespace Plasma
00027 {
00028
00029 class HistoryComboBox::Private
00030 {
00031 public:
00032 Private()
00033 {
00034 }
00035
00036 ~Private()
00037 {
00038 historyCombo = 0;
00039 }
00040
00041 KHistoryComboBox *historyCombo;
00042 };
00043
00044 HistoryComboBox::HistoryComboBox(QGraphicsWidget *parent)
00045 : QGraphicsProxyWidget(parent),
00046 d(new Private)
00047 {
00048 KHistoryComboBox* native = new KHistoryComboBox;
00049
00050 connect(native, SIGNAL(cleared()), this, SIGNAL(cleared()));
00051 connect(native, SIGNAL(returnPressed(const QString &)), this, SIGNAL(returnPressed(const QString &)));
00052 connect(native, SIGNAL(textChanged(const QString &)), this, SIGNAL(textChanged(const QString &)));
00053 connect(native, SIGNAL(returnPressed()), this, SIGNAL(returnPressed()));
00054 connect(native, SIGNAL(activated(int)), this, SIGNAL(activated(int)));
00055 setWidget(native);
00056
00057 native->setAttribute(Qt::WA_NoSystemBackground);
00058 native->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Fixed);
00059 setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Fixed);
00060
00061 d->historyCombo = native;
00062 }
00063
00064 HistoryComboBox::~HistoryComboBox()
00065 {
00066 delete d;
00067 }
00068
00069
00070 void HistoryComboBox::setStylesheet(const QString &stylesheet)
00071 {
00072 d->historyCombo->setStyleSheet(stylesheet);
00073 }
00074
00075 QString HistoryComboBox::stylesheet()
00076 {
00077 return d->historyCombo->styleSheet();
00078 }
00079
00080 KHistoryComboBox* HistoryComboBox::nativeWidget() const
00081 {
00082 return static_cast<KHistoryComboBox*>(d->historyCombo);
00083 }
00084
00085 void HistoryComboBox::resizeEvent(QGraphicsSceneResizeEvent *event)
00086 {
00087 QGraphicsProxyWidget::resizeEvent(event);
00088 }
00089
00090 QStringList HistoryComboBox::historyItems() const
00091 {
00092 return d->historyCombo->historyItems();
00093 }
00094
00095 bool HistoryComboBox::removeFromHistory(const QString &item)
00096 {
00097 return d->historyCombo->removeFromHistory(item);
00098 }
00099
00100 void HistoryComboBox::reset()
00101 {
00102 d->historyCombo->reset();
00103 }
00104
00105 void HistoryComboBox::setHistoryItems(const QStringList &items)
00106 {
00107 d->historyCombo->setHistoryItems(items);
00108 }
00109
00110 QString HistoryComboBox::currentText() const
00111 {
00112 return d->historyCombo->currentText();
00113 }
00114
00115 void HistoryComboBox::insertUrl(int index, const KUrl &url)
00116 {
00117 d->historyCombo->insertUrl(index, url);
00118 }
00119
00120 void HistoryComboBox::setDuplicatesEnabled(bool enabled)
00121 {
00122 d->historyCombo->setDuplicatesEnabled(enabled);
00123 }
00124
00125 void HistoryComboBox::addToHistory(const QString &item)
00126 {
00127 d->historyCombo->addToHistory(item);
00128 }
00129
00130 }
00131
00132 #include <historycombobox.moc>
00133