From f24af9b9aea23cac811e11014b38e435b7c1a818 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jon=20Ander=20Pe=C3=B1alba?= Date: Fri, 10 Sep 2010 11:50:38 +0200 Subject: The RSS widget and the bookmark widget are now more consistent (they have the same look and behavior) --- src/urlbar/rsswidget.cpp | 53 ++++++++++++++++++------------------------------ 1 file changed, 20 insertions(+), 33 deletions(-) (limited to 'src/urlbar/rsswidget.cpp') diff --git a/src/urlbar/rsswidget.cpp b/src/urlbar/rsswidget.cpp index 25587502..270468a1 100644 --- a/src/urlbar/rsswidget.cpp +++ b/src/urlbar/rsswidget.cpp @@ -30,42 +30,40 @@ // Local includes #include "application.h" +#include "iconmanager.h" #include "mainwindow.h" #include "webtab.h" -#include "webview.h" -#include "iconmanager.h" // KDE Includes +#include #include -#include -#include #include +#include +#include // Qt Includes -#include +#include +#include + #include +#include #include #include -#include -#include - - RSSWidget::RSSWidget(const QMap< KUrl, QString > &map, QWidget *parent) - : QFrame(parent, Qt::Popup) + : QMenu(parent) , m_map(map) { setAttribute(Qt::WA_DeleteOnClose); - - setMinimumWidth(200); - setFrameStyle(Panel); + setMinimumWidth(250); QFormLayout *layout = new QFormLayout(this); - setLayout(layout); + // Title QLabel *title = new QLabel(this); title->setText(i18n("

Subscribe to RSS Feeds

")); + title->setAlignment(Qt::AlignCenter); layout->addRow(title); // Agregators @@ -74,7 +72,7 @@ RSSWidget::RSSWidget(const QMap< KUrl, QString > &map, QWidget *parent) m_agregators = new KComboBox(this); m_agregators->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Fixed); - + m_agregators->addItem(KIcon("akregator"), QString("Akregator")); m_agregators->addItem(Application::iconManager()->iconForUrl(KUrl("http://google.com/reader")), i18n("Google Reader")); @@ -91,37 +89,34 @@ RSSWidget::RSSWidget(const QMap< KUrl, QString > &map, QWidget *parent) { m_feeds->addItem(title); } - + layout->addRow(feed, m_feeds); // Buttons QDialogButtonBox *buttonBox = new QDialogButtonBox(QDialogButtonBox::Cancel, Qt::Horizontal, this); - + QPushButton *addFeed = new QPushButton(KIcon("list-add"), i18n("Add Feed"), buttonBox); buttonBox->addButton(addFeed, QDialogButtonBox::AcceptRole); - + connect(buttonBox, SIGNAL(accepted()), this, SLOT(accept())); connect(buttonBox, SIGNAL(rejected()), this, SLOT(reject())); layout->addRow(buttonBox); + + setLayout(layout); } RSSWidget::~RSSWidget() { - delete m_agregators; - delete m_feeds; } void RSSWidget::showAt(const QPoint &pos) { adjustSize(); - - QPoint p; - p.setX(pos.x() - width()); - p.setY(pos.y() + 10); - + + QPoint p(pos.x()-width(), pos.y()+10); move(p); show(); } @@ -136,14 +131,7 @@ void RSSWidget::accept() else addWithGoogleReader(url); - reject(); -} - - -void RSSWidget::reject() -{ close(); - this->deleteLater(); } @@ -179,6 +167,5 @@ void RSSWidget::addWithAkregator(const QString &url) KMessageBox::error(0, QString(i18n("There was an error. Please verify Akregator is installed on your system.") + "

" + url + "")); } - } } -- cgit v1.2.1 From b2f8b1e4a123069bbf131aa4bd50fd67cd93727f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jon=20Ander=20Pe=C3=B1alba?= Date: Fri, 10 Sep 2010 12:04:47 +0200 Subject: Minor bug introduced in previous commit fixed --- src/urlbar/rsswidget.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/urlbar/rsswidget.cpp') diff --git a/src/urlbar/rsswidget.cpp b/src/urlbar/rsswidget.cpp index 270468a1..b29ed0e8 100644 --- a/src/urlbar/rsswidget.cpp +++ b/src/urlbar/rsswidget.cpp @@ -99,7 +99,7 @@ RSSWidget::RSSWidget(const QMap< KUrl, QString > &map, QWidget *parent) buttonBox->addButton(addFeed, QDialogButtonBox::AcceptRole); connect(buttonBox, SIGNAL(accepted()), this, SLOT(accept())); - connect(buttonBox, SIGNAL(rejected()), this, SLOT(reject())); + connect(buttonBox, SIGNAL(rejected()), this, SLOT(close())); layout->addRow(buttonBox); -- cgit v1.2.1