summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorJon Ander Peñalba <jonan88@gmail.com>2010-09-10 11:50:38 +0200
committerJon Ander Peñalba <jonan88@gmail.com>2010-09-10 11:50:38 +0200
commitf24af9b9aea23cac811e11014b38e435b7c1a818 (patch)
tree65385eee0ca3a8b0c0374a4419e7e09250af1989 /src
parentBookmarkWidget now inherits from QMenu (much nicer). (diff)
downloadrekonq-f24af9b9aea23cac811e11014b38e435b7c1a818.tar.xz
The RSS widget and the bookmark widget are now more consistent (they have the same look and behavior)
Diffstat (limited to 'src')
-rw-r--r--src/urlbar/bookmarkwidget.cpp17
-rw-r--r--src/urlbar/bookmarkwidget.h4
-rw-r--r--src/urlbar/rsswidget.cpp53
-rw-r--r--src/urlbar/rsswidget.h20
4 files changed, 32 insertions, 62 deletions
diff --git a/src/urlbar/bookmarkwidget.cpp b/src/urlbar/bookmarkwidget.cpp
index ca04cd4f..59df85a1 100644
--- a/src/urlbar/bookmarkwidget.cpp
+++ b/src/urlbar/bookmarkwidget.cpp
@@ -64,10 +64,7 @@ BookmarkWidget::BookmarkWidget(const KBookmark &bookmark, QWidget *parent)
// Title
QVBoxLayout *vLayout = new QVBoxLayout(this);
QLabel *bookmarkInfo = new QLabel(this);
- bookmarkInfo->setText(i18n("Edit this Bookmark"));
- QFont font;
- font.setPointSize(font.pointSize() + 2);
- bookmarkInfo->setFont(font);
+ bookmarkInfo->setText(i18n("<h4>Edit this Bookmark</h4>"));
bookmarkInfo->setAlignment(Qt::AlignCenter);
vLayout->addWidget(bookmarkInfo);
@@ -113,7 +110,9 @@ BookmarkWidget::~BookmarkWidget()
void BookmarkWidget::showAt(const QPoint &pos)
{
- QPoint p(pos.x()-350, pos.y()+12);
+ adjustSize();
+
+ QPoint p(pos.x()-width(), pos.y()+10);
move(p);
show();
}
@@ -126,12 +125,6 @@ void BookmarkWidget::accept()
m_bookmark->setFullText(m_name->text());
Application::bookmarkProvider()->bookmarkManager()->emitChanged();
}
- reject();
-}
-
-
-void BookmarkWidget::reject()
-{
close();
}
@@ -139,5 +132,5 @@ void BookmarkWidget::reject()
void BookmarkWidget::removeBookmark()
{
Application::bookmarkProvider()->bookmarkOwner()->deleteBookmark(*m_bookmark);
- reject();
+ close();
}
diff --git a/src/urlbar/bookmarkwidget.h b/src/urlbar/bookmarkwidget.h
index e97c1859..e07dac24 100644
--- a/src/urlbar/bookmarkwidget.h
+++ b/src/urlbar/bookmarkwidget.h
@@ -27,9 +27,6 @@
#ifndef BOOKMARKWIDGET_H
#define BOOKMARKWIDGET_H
-// Rekonq Includes
-#include "rekonq_defines.h"
-
// Qt Includes
#include <QtGui/QMenu>
@@ -50,7 +47,6 @@ public:
private slots:
void accept();
- void reject();
void removeBookmark();
private:
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 <KComboBox>
#include <KLocalizedString>
-#include <KIcon>
-#include <KProcess>
#include <KMessageBox>
+#include <KProcess>
+#include <KUrl>
// Qt Includes
-#include <QtGui/QFormLayout>
+#include <QtDBus/QDBusConnectionInterface>
+#include <QtDBus/QDBusInterface>
+
#include <QtGui/QDialogButtonBox>
+#include <QtGui/QFormLayout>
#include <QtGui/QLabel>
#include <QtGui/QPushButton>
-#include <QtDBus/QDBusInterface>
-#include <QtDBus/QDBusConnectionInterface>
-
-
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("<h4>Subscribe to RSS Feeds</h4>"));
+ 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.")
+ "<br /><br /> <a href=\"" + url + "\">" + url + "</a>"));
}
-
}
}
diff --git a/src/urlbar/rsswidget.h b/src/urlbar/rsswidget.h
index 0272805e..33c34e76 100644
--- a/src/urlbar/rsswidget.h
+++ b/src/urlbar/rsswidget.h
@@ -27,20 +27,15 @@
#ifndef RSSWIDGET_H
#define RSSWIDGET_H
-// Rekonq Includes
-#include "rekonq_defines.h"
-
-// KDE Includes
-#include <KComboBox>
-#include <KUrl>
-
// Qt Includes
-#include <QtCore/QMap>
+#include <QtGui/QMenu>
-#include <QtGui/QFrame>
+// Forward Declarations
+class KComboBox;
+class KUrl;
-class RSSWidget : public QFrame
+class RSSWidget : public QMenu
{
Q_OBJECT
@@ -48,13 +43,12 @@ public:
// QMap< feedUrl, feedTitle>
RSSWidget(const QMap<KUrl, QString> &map, QWidget *parent = 0);
~RSSWidget();
-
+
void showAt(const QPoint &pos);
private slots:
void accept();
- void reject();
-
+
private:
void addWithAkregator(const QString &url);
void addWithGoogleReader(const QString &url);