summaryrefslogtreecommitdiff
path: root/src/urlbar
diff options
context:
space:
mode:
Diffstat (limited to 'src/urlbar')
-rw-r--r--src/urlbar/rsswidget.cpp36
-rw-r--r--src/urlbar/rsswidget.h18
2 files changed, 35 insertions, 19 deletions
diff --git a/src/urlbar/rsswidget.cpp b/src/urlbar/rsswidget.cpp
index 1cce6e8c..395d7bab 100644
--- a/src/urlbar/rsswidget.cpp
+++ b/src/urlbar/rsswidget.cpp
@@ -51,7 +51,7 @@
-RSSWidget::RSSWidget(QMap< KUrl, QString > map, QWidget *parent)
+RSSWidget::RSSWidget(const QMap< KUrl, QString > &map, QWidget *parent)
: QFrame(parent, Qt::Popup)
, m_map(map)
{
@@ -87,23 +87,31 @@ RSSWidget::RSSWidget(QMap< KUrl, QString > map, QWidget *parent)
QDialogButtonBox *buttonBox = new QDialogButtonBox(QDialogButtonBox::Ok | QDialogButtonBox::Cancel, Qt::Horizontal, this);
buttonBox->button(QDialogButtonBox::Ok)->setText(i18n("Add Feed"));
- connect(buttonBox, SIGNAL(accepted()), this, SLOT(accepted()));
- connect(buttonBox, SIGNAL(rejected()), this, SLOT(close()));
+ connect(buttonBox, SIGNAL(accepted()), this, SLOT(accept()));
+ connect(buttonBox, SIGNAL(rejected()), this, SLOT(reject()));
layout->addWidget(buttonBox);
}
-void RSSWidget::showAt(QPoint pos)
+RSSWidget::~RSSWidget()
{
- pos.setX(pos.x() - 200);
- pos.setY(pos.y() + 10);
- move(pos);
+ delete m_agregators;
+ delete m_feeds;
+}
+
+
+void RSSWidget::showAt(const QPoint &pos)
+{
+ QPoint p;
+ p.setX(pos.x() - 200);
+ p.setY(pos.y() + 10);
+ move(p);
show();
}
-void RSSWidget::accepted()
+void RSSWidget::accept()
{
QString url = m_map.key(m_feeds->currentText()).toMimeDataString();
@@ -112,18 +120,25 @@ void RSSWidget::accepted()
else
addWithGoogleReader(url);
+ reject();
+}
+
+
+void RSSWidget::reject()
+{
close();
+ this->deleteLater();
}
-void RSSWidget::addWithGoogleReader(QString url)
+void RSSWidget::addWithGoogleReader(const QString &url)
{
KUrl toLoad = KUrl("http://www.google.com/ig/add?feedurl=" + url);
Application::instance()->mainWindow()->currentTab()->view()->load(toLoad);
}
-void RSSWidget::addWithAkregator(QString url)
+void RSSWidget::addWithAkregator(const QString &url)
{
// Akregator is running
if (QDBusConnection::sessionBus().interface()->isServiceRegistered("org.kde.akregator"))
@@ -151,4 +166,3 @@ void RSSWidget::addWithAkregator(QString url)
}
}
-
diff --git a/src/urlbar/rsswidget.h b/src/urlbar/rsswidget.h
index 258107eb..0272805e 100644
--- a/src/urlbar/rsswidget.h
+++ b/src/urlbar/rsswidget.h
@@ -46,16 +46,18 @@ class RSSWidget : public QFrame
public:
// QMap< feedUrl, feedTitle>
- RSSWidget(QMap<KUrl, QString> map, QWidget *parent);
-
- void showAt(QPoint pos);
-
-public slots:
- void accepted();
+ RSSWidget(const QMap<KUrl, QString> &map, QWidget *parent = 0);
+ ~RSSWidget();
+
+ void showAt(const QPoint &pos);
+private slots:
+ void accept();
+ void reject();
+
private:
- void addWithAkregator(QString url);
- void addWithGoogleReader(QString url);
+ void addWithAkregator(const QString &url);
+ void addWithGoogleReader(const QString &url);
QMap<KUrl, QString> m_map;