summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/CMakeLists.txt1
-rw-r--r--src/bookmarks/bookmarkcontextmenu.cpp7
-rw-r--r--src/bookmarks/bookmarksmanager.cpp44
-rw-r--r--src/bookmarks/bookmarksmanager.h5
-rw-r--r--src/bookmarks/bookmarkstreemodel.cpp12
-rw-r--r--src/data/rekonq.desktop5
-rw-r--r--src/findbar.cpp11
-rw-r--r--src/findbar.h3
-rw-r--r--src/urlbar/bookmarkwidget.cpp172
-rw-r--r--src/urlbar/bookmarkwidget.h63
-rw-r--r--src/urlbar/urlbar.cpp49
-rw-r--r--src/urlbar/urlbar.h3
-rw-r--r--src/zoombar.cpp17
-rw-r--r--src/zoombar.h5
14 files changed, 364 insertions, 33 deletions
diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt
index 22419da0..239f5b3b 100644
--- a/src/CMakeLists.txt
+++ b/src/CMakeLists.txt
@@ -59,6 +59,7 @@ SET( rekonq_KDEINIT_SRCS
urlbar/urlresolver.cpp
urlbar/listitem.cpp
urlbar/rsswidget.cpp
+ urlbar/bookmarkwidget.cpp
#----------------------------------------
analyzer/analyzerpanel.cpp
analyzer/networkanalyzer.cpp
diff --git a/src/bookmarks/bookmarkcontextmenu.cpp b/src/bookmarks/bookmarkcontextmenu.cpp
index 96668003..019d9eb9 100644
--- a/src/bookmarks/bookmarkcontextmenu.cpp
+++ b/src/bookmarks/bookmarkcontextmenu.cpp
@@ -268,8 +268,11 @@ void BookmarkContextMenu::newBookmarkGroup()
{
KBookmark newBk;
newBk = dialog->createNewFolder("New folder", selected.parentGroup());
- selected.parentGroup().moveBookmark(newBk, selected);
- manager()->emitChanged(newBk.parentGroup());
+ if (!newBk.isNull())
+ {
+ selected.parentGroup().moveBookmark(newBk, selected);
+ manager()->emitChanged(newBk.parentGroup());
+ }
}
}
else
diff --git a/src/bookmarks/bookmarksmanager.cpp b/src/bookmarks/bookmarksmanager.cpp
index 792baaeb..bba9dd77 100644
--- a/src/bookmarks/bookmarksmanager.cpp
+++ b/src/bookmarks/bookmarksmanager.cpp
@@ -388,13 +388,15 @@ BookmarkProvider::~BookmarkProvider()
void BookmarkProvider::setupBookmarkBar(BookmarkToolBar *toolbar)
{
+ if (m_bookmarkToolBars.contains(toolbar))
+ return;
+
kDebug() << "new bookmark bar...";
-
+
m_bookmarkToolBars.append(toolbar);
toolbar->setContextMenuPolicy(Qt::CustomContextMenu);
connect(toolbar, SIGNAL(customContextMenuRequested(const QPoint &)), this, SLOT(contextMenu(const QPoint &)));
- slotBookmarksChanged("", "");
kDebug() << "new bookmark bar... DONE!";
}
@@ -591,3 +593,41 @@ void BookmarkProvider::slotPanelChanged()
panel->startLoadFoldedState();
}
}
+
+
+KBookmark BookmarkProvider::bookmarkForUrl(const KUrl &url)
+{
+ KBookmark found;
+
+ KBookmarkGroup root = rootGroup();
+ if (root.isNull())
+ {
+ return found;
+ }
+
+ return bookmarkForUrl(root, url);
+}
+
+
+KBookmark BookmarkProvider::bookmarkForUrl(const KBookmark &bookmark, const KUrl &url)
+{
+ KBookmark found;
+
+ if (bookmark.isGroup())
+ {
+ KBookmarkGroup group = bookmark.toGroup();
+ KBookmark bookmark = group.first();
+
+ while (!bookmark.isNull() && found.isNull())
+ {
+ found = bookmarkForUrl(bookmark, url);
+ bookmark = group.next(bookmark);
+ }
+ }
+ else if (!bookmark.isSeparator() && bookmark.url() == url)
+ {
+ found = bookmark;
+ }
+
+ return found;
+}
diff --git a/src/bookmarks/bookmarksmanager.h b/src/bookmarks/bookmarksmanager.h
index 72ea1c3c..eeb5391d 100644
--- a/src/bookmarks/bookmarksmanager.h
+++ b/src/bookmarks/bookmarksmanager.h
@@ -271,6 +271,8 @@ public:
void registerBookmarkPanel(BookmarksPanel *panel);
void removeBookmarkPanel(BookmarksPanel *panel);
+ KBookmark bookmarkForUrl(const KUrl &url);
+
signals:
/**
* @short This signal is emitted when an url has to be loaded
@@ -305,6 +307,9 @@ private slots:
private:
QList<KBookmark> find(QList<KBookmark> list, const KBookmark &bookmark, QString text);
+ QString titleForBookmarkUrl(const KBookmark &bookmark, const QString &url);
+ KBookmark bookmarkForUrl(const KBookmark &bookmark, const KUrl &url);
+
KBookmarkManager *m_manager;
BookmarkOwner *m_owner;
KActionCollection *m_actionCollection;
diff --git a/src/bookmarks/bookmarkstreemodel.cpp b/src/bookmarks/bookmarkstreemodel.cpp
index 7063bf9b..299efaf0 100644
--- a/src/bookmarks/bookmarkstreemodel.cpp
+++ b/src/bookmarks/bookmarkstreemodel.cpp
@@ -406,15 +406,15 @@ bool BookmarksTreeModel::dropMimeData(const QMimeData *data, Qt::DropAction acti
if (parent.isValid())
root = bookmarkForIndex(parent).toGroup();
- if (!destIndex.isValid())
+ if (destIndex.isValid() && row != -1)
{
- root.deleteBookmark(bookmark);
- root.addBookmark(bookmark);
- }
+ root.moveBookmark(bookmark, root.previous(dropDestBookmark));
- else if (row != 1)
+ }
+ else
{
- root.moveBookmark(bookmark, root.previous(dropDestBookmark));
+ root.deleteBookmark(bookmark);
+ root.addBookmark(bookmark);
}
Application::bookmarkProvider()->bookmarkManager()->emitChanged();
diff --git a/src/data/rekonq.desktop b/src/data/rekonq.desktop
index a29d37e5..f8a78960 100644
--- a/src/data/rekonq.desktop
+++ b/src/data/rekonq.desktop
@@ -34,8 +34,13 @@ GenericName[de]=Webbrowser
GenericName[en_GB]=Web Browser
GenericName[es]=Navegador web
GenericName[fr]=Navigateur web
+GenericName[it]=Browser Web
GenericName[pt]=Navegador Web
GenericName[pt_BR]=Navegador Web
+GenericName[sr]=Веб прегледач
+GenericName[sr@ijekavian]=Веб прегледач
+GenericName[sr@ijekavianlatin]=Veb pregledač
+GenericName[sr@latin]=Veb pregledač
GenericName[sv]=Webbläsare
GenericName[uk]=Переглядач Інтернету
GenericName[x-test]=xxWeb Browserxx
diff --git a/src/findbar.cpp b/src/findbar.cpp
index 495e4f96..b3b80fac 100644
--- a/src/findbar.cpp
+++ b/src/findbar.cpp
@@ -144,6 +144,7 @@ void FindBar::show()
// show findbar if not visible
if (isHidden())
{
+ emit visibilityChanged(true);
QWidget::show();
emit searchString(m_lineEdit->text());
}
@@ -183,19 +184,13 @@ void FindBar::notifyMatch(bool match)
void FindBar::hide()
{
m_hideTimer->stop();
+ emit visibilityChanged(false);
QWidget::hide();
emit(searchString(m_lineEdit->text()));
}
-void FindBar::setVisible(bool visible)
-{
- emit visibilityChanged(visible);
- QWidget::setVisible(visible);
-}
-
-
void FindBar::toggleVisibility()
{
- setVisible(!isVisible());
+ isVisible() ? hide() : show();
}
diff --git a/src/findbar.h b/src/findbar.h
index 63b2949b..38bbcbc5 100644
--- a/src/findbar.h
+++ b/src/findbar.h
@@ -64,9 +64,6 @@ signals:
void searchString(const QString &);
void visibilityChanged(bool);
-protected:
- void setVisible(bool visible);
-
private:
KLineEdit *m_lineEdit;
QTimer *m_hideTimer;
diff --git a/src/urlbar/bookmarkwidget.cpp b/src/urlbar/bookmarkwidget.cpp
new file mode 100644
index 00000000..3380ec57
--- /dev/null
+++ b/src/urlbar/bookmarkwidget.cpp
@@ -0,0 +1,172 @@
+/* ============================================================
+*
+* This file is a part of the rekonq project
+*
+* Copyright (C) 2010 by Yoann Laissus <yoann dot laissus at gmail dot com>
+*
+*
+* This program is free software; you can redistribute it and/or
+* modify it under the terms of the GNU General Public License as
+* published by the Free Software Foundation; either version 2 of
+* the License or (at your option) version 3 or any later version
+* accepted by the membership of KDE e.V. (or its successor approved
+* by the membership of KDE e.V.), which shall act as a proxy
+* defined in Section 14 of version 3 of the license.
+*
+* This program is distributed in the hope that it will be useful,
+* but WITHOUT ANY WARRANTY; without even the implied warranty of
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+* GNU General Public License for more details.
+*
+* You should have received a copy of the GNU General Public License
+* along with this program. If not, see <http://www.gnu.org/licenses/>.
+*
+* ============================================================ */
+
+
+// Auto Includes
+#include "bookmarkwidget.h"
+#include "bookmarkwidget.moc"
+
+// Local includes
+#include "application.h"
+#include "bookmarksmanager.h"
+
+// KDE Includes
+#include <KLocalizedString>
+#include <KLineEdit>
+#include <KMessageBox>
+
+// Qt Includes
+#include <QtGui/QFormLayout>
+#include <QtGui/QDialogButtonBox>
+#include <QtGui/QLabel>
+#include <QtGui/QPushButton>
+
+
+
+BookmarkWidget::BookmarkWidget(const KBookmark &bookmark, QWidget *parent)
+ : QFrame(parent, Qt::Popup)
+ , m_bookmark(bookmark)
+{
+ setAttribute(Qt::WA_DeleteOnClose);
+ setFixedWidth(350);
+ setFrameStyle(QFrame::Panel);
+
+ QFormLayout *layout = new QFormLayout(this);
+ setLayout(layout);
+
+ QHBoxLayout *hLayout = new QHBoxLayout();
+
+ QLabel *bookmarkIcon = new QLabel(this);
+ bookmarkIcon->setPixmap(KIcon("bookmarks").pixmap(32, 32));
+ hLayout->addWidget(bookmarkIcon);
+ hLayout->setSpacing(10);
+
+ QVBoxLayout *vLayout = new QVBoxLayout();
+
+ QLabel *bookmarkInfo = new QLabel(this);
+ bookmarkInfo->setText(i18n("Edit this Bookmark"));
+ QFont font;
+ font.setPointSize(font.pointSize() + 2);
+ bookmarkInfo->setFont(font);
+
+ vLayout->addWidget(bookmarkInfo);
+
+ 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);
+
+
+ QLabel *nameLabel = new QLabel(this);
+ nameLabel->setText(i18n("Name:"));
+
+ m_name = new KLineEdit(this);
+ if (m_bookmark.isNull())
+ {
+ m_name->setEnabled(false);
+ }
+ else
+ {
+ 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);
+
+ 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()));
+
+ layout->addWidget(buttonBox);
+}
+
+
+BookmarkWidget::~BookmarkWidget()
+{
+ delete m_name;
+}
+
+
+void BookmarkWidget::accept()
+{
+ if (!m_bookmark.isNull() && m_name->text() != m_bookmark.fullText())
+ {
+ m_bookmark.setFullText(m_name->text());
+ Application::bookmarkProvider()->bookmarkManager()->emitChanged();
+ }
+ reject();
+}
+
+
+void BookmarkWidget::reject()
+{
+ close();
+ deleteLater();
+}
+
+
+void BookmarkWidget::showAt(const QPoint &pos)
+{
+ QPoint p;
+ p.setX(pos.x());
+ p.setY(pos.y() + 12);
+ move(p);
+ show();
+}
+
+
+void BookmarkWidget::removeBookmark()
+{
+ bool folder = m_bookmark.isGroup();
+
+ if (KMessageBox::warningContinueCancel(
+ QApplication::activeWindow(),
+ folder ? i18n("Are you sure you wish to remove the bookmark folder\n\"%1\"?", m_bookmark.text())
+ : i18n("Are you sure you wish to remove the bookmark\n\"%1\"?", m_bookmark.text()),
+ folder ? i18n("Bookmark Folder Deletion")
+ : i18n("Bookmark Deletion"),
+ KStandardGuiItem::del())
+ == KMessageBox::Continue
+ )
+ {
+ m_bookmark.parentGroup().deleteBookmark(m_bookmark);
+ Application::bookmarkProvider()->bookmarkManager()->emitChanged();
+ }
+
+ reject();
+}
diff --git a/src/urlbar/bookmarkwidget.h b/src/urlbar/bookmarkwidget.h
new file mode 100644
index 00000000..cdab328e
--- /dev/null
+++ b/src/urlbar/bookmarkwidget.h
@@ -0,0 +1,63 @@
+/* ============================================================
+*
+* This file is a part of the rekonq project
+*
+* Copyright (C) 2010 by Yoann Laissus <yoann dot laissus at gmail dot com>
+*
+*
+* This program is free software; you can redistribute it and/or
+* modify it under the terms of the GNU General Public License as
+* published by the Free Software Foundation; either version 2 of
+* the License or (at your option) version 3 or any later version
+* accepted by the membership of KDE e.V. (or its successor approved
+* by the membership of KDE e.V.), which shall act as a proxy
+* defined in Section 14 of version 3 of the license.
+*
+* This program is distributed in the hope that it will be useful,
+* but WITHOUT ANY WARRANTY; without even the implied warranty of
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+* GNU General Public License for more details.
+*
+* You should have received a copy of the GNU General Public License
+* along with this program. If not, see <http://www.gnu.org/licenses/>.
+*
+* ============================================================ */
+
+
+#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>
+
+
+class BookmarkWidget : public QFrame
+{
+ Q_OBJECT
+
+public:
+ BookmarkWidget(const KBookmark &bookmark, QWidget *parent = 0);
+ ~BookmarkWidget();
+
+ void showAt(const QPoint &pos);
+
+private slots:
+ void accept();
+ void reject();
+ void removeBookmark();
+
+private:
+ KBookmark m_bookmark;
+ KLineEdit *m_name;
+
+};
+
+#endif // BOOKMARKWIDGET_H
diff --git a/src/urlbar/urlbar.cpp b/src/urlbar/urlbar.cpp
index d924a30d..e2033120 100644
--- a/src/urlbar/urlbar.cpp
+++ b/src/urlbar/urlbar.cpp
@@ -41,6 +41,8 @@
#include "webpage.h"
#include "webview.h"
#include "completionwidget.h"
+#include "bookmarksmanager.h"
+#include "bookmarkwidget.h"
// KDE Includes
#include <KCompletionBox>
@@ -107,6 +109,11 @@ UrlBar::UrlBar(QWidget *parent)
connect(_tab->view(), SIGNAL(loadFinished(bool)), this, SLOT(loadFinished()));
connect(_tab->view(), SIGNAL(loadStarted()), this, SLOT(clearRightIcons()));
+ // bookmark icon
+ _icon->setIcon(KIcon("bookmarks").pixmap(32,32, QIcon::Disabled));
+ connect(Application::bookmarkProvider()->bookmarkManager(), SIGNAL(changed(const QString &, const QString &)), this, SLOT(onBookmarksChanged()));
+ connect(_icon, SIGNAL(clicked(const QPoint &)), this, SLOT(showBookmarkInfo(const QPoint &)));
+
// load typed urls
connect(this, SIGNAL(returnPressed(const QString &)), this, SLOT(loadTyped(const QString &)));
@@ -138,7 +145,8 @@ void UrlBar::setQUrl(const QUrl& url)
clearFocus();
KLineEdit::setUrl(url);
setCursorPosition(0);
- _icon->setIcon(Application::icon(url));
+// _icon->setIcon(Application::icon(url));
+// updateIcon();
}
}
@@ -300,6 +308,16 @@ void UrlBar::loadFinished()
return;
}
+ // setting bookmark icon
+ if (Application::bookmarkProvider()->bookmarkForUrl(_tab->url()).isNull())
+ {
+ _icon->setIcon(KIcon("bookmarks").pixmap(32,32, QIcon::Disabled));
+ }
+ else
+ {
+ _icon->setIcon(KIcon("bookmarks"));
+ }
+
// show KGet downloads??
if (ReKonfig::kgetList())
{
@@ -330,6 +348,35 @@ void UrlBar::loadFinished()
}
+void UrlBar::showBookmarkInfo(const QPoint &pos)
+{
+ if( _tab->url().scheme() == QL1S("about") )
+ return;
+
+ KBookmark bookmark = Application::bookmarkProvider()->bookmarkForUrl(_tab->url());
+
+ IconButton *bt = qobject_cast<IconButton *>(this->sender());
+ if (!bt)
+ return;
+
+ if (bookmark.isNull())
+ {
+ bookmark = Application::bookmarkProvider()->rootGroup().addBookmark(_tab->view()->title(), _tab->url());
+ Application::bookmarkProvider()->bookmarkManager()->emitChanged();
+ }
+
+ BookmarkWidget *widget = new BookmarkWidget(bookmark, window());
+ widget->showAt(pos);
+}
+
+
+void UrlBar::onBookmarksChanged()
+{
+ clearRightIcons();
+ loadFinished();
+}
+
+
void UrlBar::loadTyped(const QString &text)
{
activated( KUrl(text) );
diff --git a/src/urlbar/urlbar.h b/src/urlbar/urlbar.h
index 7fbe8bb4..d0e2b60e 100644
--- a/src/urlbar/urlbar.h
+++ b/src/urlbar/urlbar.h
@@ -104,6 +104,9 @@ private slots:
void detectTypedString(const QString &);
void suggest();
+ void showBookmarkInfo(const QPoint &pos);
+ void onBookmarksChanged();
+
protected:
void paintEvent(QPaintEvent *event);
void keyPressEvent(QKeyEvent *event);
diff --git a/src/zoombar.cpp b/src/zoombar.cpp
index 485d71a9..b07aee03 100644
--- a/src/zoombar.cpp
+++ b/src/zoombar.cpp
@@ -124,11 +124,19 @@ void ZoomBar::show()
// show findbar if not visible
if (isHidden())
{
+ emit visibilityChanged(true);
QWidget::show();
}
}
+void ZoomBar::hide()
+{
+ emit visibilityChanged(false);
+ QWidget::hide();
+}
+
+
void ZoomBar::zoomIn()
{
setValue(m_zoomSlider->value() + 1);
@@ -168,14 +176,7 @@ void ZoomBar::setValue(int value)
}
-void ZoomBar::setVisible(bool visible)
-{
- emit visibilityChanged(visible);
- QWidget::setVisible(visible);
-}
-
-
void ZoomBar::toggleVisibility()
{
- setVisible(!isVisible());
+ isVisible() ? hide() : show();
}
diff --git a/src/zoombar.h b/src/zoombar.h
index 8e8d9aba..adb0067b 100644
--- a/src/zoombar.h
+++ b/src/zoombar.h
@@ -54,6 +54,8 @@ public:
public slots:
void show();
+ void hide();
+
void zoomIn();
void zoomOut();
void zoomNormal();
@@ -65,9 +67,6 @@ public slots:
signals:
void visibilityChanged(bool);
-protected:
- void setVisible(bool visible);
-
private:
QToolButton *m_zoomIn;
QToolButton *m_zoomOut;