diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/bookmarks/bookmarkprovider.cpp | 2 | ||||
-rw-r--r-- | src/history/historymanager.cpp | 2 | ||||
-rw-r--r-- | src/iconmanager.cpp | 4 | ||||
-rw-r--r-- | src/urlbar/bookmarkwidget.cpp | 87 | ||||
-rw-r--r-- | src/urlbar/bookmarkwidget.h | 22 | ||||
-rw-r--r-- | src/urlbar/listitem.cpp | 2 | ||||
-rw-r--r-- | src/urlbar/rsswidget.cpp | 55 | ||||
-rw-r--r-- | src/urlbar/rsswidget.h | 20 | ||||
-rw-r--r-- | src/urlbar/urlbar.cpp | 8 |
9 files changed, 81 insertions, 121 deletions
diff --git a/src/bookmarks/bookmarkprovider.cpp b/src/bookmarks/bookmarkprovider.cpp index 3e2d2814..beca5475 100644 --- a/src/bookmarks/bookmarkprovider.cpp +++ b/src/bookmarks/bookmarkprovider.cpp @@ -266,7 +266,7 @@ void BookmarkProvider::find(QList<KBookmark> *list, const KBookmark &bookmark, c } else { - QStringList words = text.split(" "); + QStringList words = text.split(' '); bool matches = true; foreach (const QString &word, words) { diff --git a/src/history/historymanager.cpp b/src/history/historymanager.cpp index 4a3039f3..4a2c0459 100644 --- a/src/history/historymanager.cpp +++ b/src/history/historymanager.cpp @@ -240,7 +240,7 @@ QList<HistoryItem> HistoryManager::find(const QString &text) int index = m_historyFilterModel->historyLocation(url); HistoryItem item = m_history.at(index); - QStringList words = text.split(" "); + QStringList words = text.split(' '); bool matches = true; foreach (const QString &word, words) { diff --git a/src/iconmanager.cpp b/src/iconmanager.cpp index c4b9751d..5086c59d 100644 --- a/src/iconmanager.cpp +++ b/src/iconmanager.cpp @@ -98,7 +98,7 @@ KIcon IconManager::iconForUrl(const KUrl &url) return KIcon(faviconDir + i); } - kDebug() << "Icon NOT Found. returning text-html one"; + kDebug() << "Icon NOT Found for url: " << url; return KIcon("text-html"); } @@ -149,7 +149,7 @@ void IconManager::provideIcon(QWebPage *page, const KUrl &url, bool notify) if(!relUrlString.isEmpty()) { - faviconUrl = relUrlString.startsWith("http") + faviconUrl = relUrlString.startsWith(QL1S("http")) ? KUrl(relUrlString) : KUrl(rootUrlString + QL1C('/') + relUrlString) ; } diff --git a/src/urlbar/bookmarkwidget.cpp b/src/urlbar/bookmarkwidget.cpp index cb711723..409f1468 100644 --- a/src/urlbar/bookmarkwidget.cpp +++ b/src/urlbar/bookmarkwidget.cpp @@ -35,124 +35,105 @@ // KDE Includes #include <KLocalizedString> +#include <KIcon> #include <KLineEdit> -#include <KMessageBox> // Qt Includes -#include <QtGui/QFormLayout> #include <QtGui/QDialogButtonBox> +#include <QtGui/QFormLayout> #include <QtGui/QLabel> #include <QtGui/QPushButton> - BookmarkWidget::BookmarkWidget(const KBookmark &bookmark, QWidget *parent) - : QFrame(parent, Qt::Popup) - , m_bookmark(bookmark) + : QMenu(parent) + , m_bookmark(new KBookmark(bookmark)) { setAttribute(Qt::WA_DeleteOnClose); setFixedWidth(350); - setFrameStyle(QFrame::Panel); QFormLayout *layout = new QFormLayout(this); - setLayout(layout); - - QHBoxLayout *hLayout = new QHBoxLayout(); + // Bookmark icon + QHBoxLayout *hLayout = new QHBoxLayout(this); QLabel *bookmarkIcon = new QLabel(this); bookmarkIcon->setPixmap(KIcon("bookmarks").pixmap(32, 32)); - hLayout->addWidget(bookmarkIcon); hLayout->setSpacing(10); + hLayout->addWidget(bookmarkIcon); - QVBoxLayout *vLayout = new QVBoxLayout(); - + // 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->setAlignment(Qt::AlignCenter); vLayout->addWidget(bookmarkInfo); + // Remove button QPushButton *removeButton = new QPushButton(this); removeButton->setText(i18n("Remove this Bookmark")); connect(removeButton, SIGNAL(clicked()), this, SLOT(removeBookmark())); - vLayout->addWidget(removeButton); + hLayout->addLayout(vLayout); layout->addItem(hLayout); - + // Bookmark name QLabel *nameLabel = new QLabel(this); nameLabel->setText(i18n("Name:")); - m_name = new KLineEdit(this); - if (m_bookmark.isNull()) + if (m_bookmark->isNull()) { m_name->setEnabled(false); } else { - m_name->setText(m_bookmark.text()); + m_name->setText(m_bookmark->text()); m_name->setFocus(); } - layout->addRow(nameLabel, m_name); - QLabel *urlLabel = new QLabel(this); - urlLabel->setText("URL:"); - - KLineEdit *url = new KLineEdit(this); - url->setText(m_bookmark.url().url()); - url->setEnabled(false); - - layout->addRow(urlLabel, url); - + // Ok & Cancel buttons QDialogButtonBox *buttonBox = new QDialogButtonBox(QDialogButtonBox::Ok | QDialogButtonBox::Cancel, Qt::Horizontal, this); - buttonBox->button(QDialogButtonBox::Ok)->setText(i18n("Done")); connect(buttonBox, SIGNAL(accepted()), this, SLOT(accept())); - connect(buttonBox, SIGNAL(rejected()), this, SLOT(reject())); - + connect(buttonBox, SIGNAL(rejected()), this, SLOT(close())); layout->addWidget(buttonBox); + + setLayout(layout); } BookmarkWidget::~BookmarkWidget() { - delete m_name; + delete m_bookmark; } -void BookmarkWidget::accept() +void BookmarkWidget::showAt(const QPoint &pos) { - if (!m_bookmark.isNull() && m_name->text() != m_bookmark.fullText()) - { - m_bookmark.setFullText(m_name->text()); - Application::bookmarkProvider()->bookmarkManager()->emitChanged(); - } - reject(); -} - + adjustSize(); -void BookmarkWidget::reject() -{ - close(); - deleteLater(); + QPoint p(pos.x()-width(), pos.y()+10); + move(p); + show(); } -void BookmarkWidget::showAt(const QPoint &pos) +void BookmarkWidget::accept() { - QPoint p; - p.setX(pos.x() - 350); - p.setY(pos.y() + 12); - move(p); - show(); + if (!m_bookmark->isNull() && m_name->text() != m_bookmark->fullText()) + { + m_bookmark->setFullText(m_name->text()); + Application::bookmarkProvider()->bookmarkManager()->emitChanged(); + } + close(); } void BookmarkWidget::removeBookmark() { - Application::bookmarkProvider()->bookmarkOwner()->deleteBookmark(m_bookmark); - reject(); + Application::bookmarkProvider()->bookmarkOwner()->deleteBookmark(*m_bookmark); + close(); } diff --git a/src/urlbar/bookmarkwidget.h b/src/urlbar/bookmarkwidget.h index c3c15e18..e07dac24 100644 --- a/src/urlbar/bookmarkwidget.h +++ b/src/urlbar/bookmarkwidget.h @@ -27,37 +27,31 @@ #ifndef BOOKMARKWIDGET_H #define BOOKMARKWIDGET_H -// Rekonq Includes -#include "rekonq_defines.h" - -// KDE Includes -#include <KUrl> -#include <KBookmark> -#include <KLineEdit> - // Qt Includes -#include <QtGui/QFrame> +#include <QtGui/QMenu> +// Forward Declarations +class KBookmark; +class KLineEdit; -class BookmarkWidget : public QFrame + +class BookmarkWidget : public QMenu { Q_OBJECT public: explicit BookmarkWidget(const KBookmark &bookmark, QWidget *parent = 0); - ~BookmarkWidget(); + virtual ~BookmarkWidget(); void showAt(const QPoint &pos); private slots: void accept(); - void reject(); void removeBookmark(); private: - KBookmark m_bookmark; + KBookmark *m_bookmark; KLineEdit *m_name; - }; #endif // BOOKMARKWIDGET_H diff --git a/src/urlbar/listitem.cpp b/src/urlbar/listitem.cpp index 5ff90056..d84a5488 100644 --- a/src/urlbar/listitem.cpp +++ b/src/urlbar/listitem.cpp @@ -209,7 +209,7 @@ TextLabel::TextLabel(const QString &text, const QString &textToPointOut, QWidget : QLabel(parent) { QString t = text; - const bool wasItalic = t.startsWith("<i>"); + const bool wasItalic = t.startsWith(QL1S("<i>")); if (wasItalic) t.remove(QRegExp("<[/ib]*>")); diff --git a/src/urlbar/rsswidget.cpp b/src/urlbar/rsswidget.cpp index 25587502..b29ed0e8 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())); + connect(buttonBox, SIGNAL(rejected()), this, SLOT(close())); 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); diff --git a/src/urlbar/urlbar.cpp b/src/urlbar/urlbar.cpp index c8aa43ff..d7f906f3 100644 --- a/src/urlbar/urlbar.cpp +++ b/src/urlbar/urlbar.cpp @@ -138,7 +138,6 @@ void UrlBar::setQUrl(const QUrl& url) { if (url.scheme() == QL1S("about")) { - _icon->setIcon(KIcon("arrow-right")); clear(); setFocus(); } @@ -503,5 +502,10 @@ void UrlBar::suggest() void UrlBar::refreshFavicon() { - _icon->setIcon(Application::iconManager()->iconForUrl(_tab->view()->url())); + KUrl u = _tab->url(); + if(u.scheme() == QL1S("about")) { + _icon->setIcon(KIcon("arrow-right")); + return; + } + _icon->setIcon(Application::iconManager()->iconForUrl(u)); } |