2 * Copyright 2008 Aaron Seigo <aseigo@kde.org>
3 * Copyright (C) 2008 Marco Martin <notmart@gmail.com>
5 * This program is free software; you can redistribute it and/or modify
6 * it under the terms of the GNU Library General Public License as
7 * published by the Free Software Foundation; either version 2, or
8 * (at your option) any later version.
10 * This program is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU General Public License for more details
15 * You should have received a copy of the GNU Library General Public
16 * License along with this program; if not, write to the
17 * Free Software Foundation, Inc.,
18 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
21 #include "historycombobox.h"
23 #include <KHistoryComboBox>
29 class HistoryComboBox::Private
41 KHistoryComboBox
*historyCombo
;
44 HistoryComboBox::HistoryComboBox(QGraphicsWidget
*parent
)
45 : QGraphicsProxyWidget(parent
),
48 KHistoryComboBox
* native
= new KHistoryComboBox
;
50 connect(native
, SIGNAL(cleared()), this, SIGNAL(cleared()));
51 connect(native
, SIGNAL(returnPressed(const QString
&)), this, SIGNAL(returnPressed(const QString
&)));
52 connect(native
, SIGNAL(textChanged(const QString
&)), this, SIGNAL(textChanged(const QString
&)));
53 connect(native
, SIGNAL(returnPressed()), this, SIGNAL(returnPressed()));
54 connect(native
, SIGNAL(activated(int)), this, SIGNAL(activated(int)));
57 native
->setAttribute(Qt::WA_NoSystemBackground
);
58 native
->setSizePolicy(QSizePolicy::Expanding
, QSizePolicy::Fixed
);
59 setSizePolicy(QSizePolicy::Expanding
, QSizePolicy::Fixed
);
61 d
->historyCombo
= native
;
64 HistoryComboBox::~HistoryComboBox()
70 void HistoryComboBox::setStylesheet(const QString
&stylesheet
)
72 d
->historyCombo
->setStyleSheet(stylesheet
);
75 QString
HistoryComboBox::stylesheet()
77 return d
->historyCombo
->styleSheet();
80 KHistoryComboBox
* HistoryComboBox::nativeWidget() const
82 return static_cast<KHistoryComboBox
*>(d
->historyCombo
);
85 void HistoryComboBox::resizeEvent(QGraphicsSceneResizeEvent
*event
)
87 QGraphicsProxyWidget::resizeEvent(event
);
90 QStringList
HistoryComboBox::historyItems() const
92 return d
->historyCombo
->historyItems();
95 bool HistoryComboBox::removeFromHistory(const QString
&item
)
97 return d
->historyCombo
->removeFromHistory(item
);
100 void HistoryComboBox::reset()
102 d
->historyCombo
->reset();
105 void HistoryComboBox::setHistoryItems(const QStringList
&items
)
107 d
->historyCombo
->setHistoryItems(items
);
110 QString
HistoryComboBox::currentText() const
112 return d
->historyCombo
->currentText();
115 void HistoryComboBox::insertUrl(int index
, const KUrl
&url
)
117 d
->historyCombo
->insertUrl(index
, url
);
120 void HistoryComboBox::setDuplicatesEnabled(bool enabled
)
122 d
->historyCombo
->setDuplicatesEnabled(enabled
);
125 void HistoryComboBox::addToHistory(const QString
&item
)
127 d
->historyCombo
->addToHistory(item
);
132 #include <historycombobox.moc>