diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/history.cpp | 1 | ||||
-rw-r--r-- | src/modelmenu.cpp | 28 | ||||
-rw-r--r-- | src/settings.cpp | 5 | ||||
-rw-r--r-- | src/settings_general.ui | 2 | ||||
-rw-r--r-- | src/webview.cpp | 149 |
5 files changed, 88 insertions, 97 deletions
diff --git a/src/history.cpp b/src/history.cpp index d67e65d0..3c63cb4e 100644 --- a/src/history.cpp +++ b/src/history.cpp @@ -1330,4 +1330,3 @@ void HistoryTreeModel::sourceRowsRemoved(const QModelIndex &parent, int start, i endRemoveRows(); } } - diff --git a/src/modelmenu.cpp b/src/modelmenu.cpp index 41c197f3..1aa5be16 100644 --- a/src/modelmenu.cpp +++ b/src/modelmenu.cpp @@ -155,15 +155,6 @@ void ModelMenu::createMenu(const QModelIndex &parent, int max, QMenu *parentMenu if (!menu) { -// QString title = parent.data().toString(); -// menu = new QMenu(title, this); -// QIcon icon = qvariant_cast<QIcon>(parent.data(Qt::DecorationRole)); -// menu->setIcon(icon); -// parentMenu->addMenu(menu); -// QVariant v; -// v.setValue(parent); -// menu->menuAction()->setData(v); -// connect(menu, SIGNAL(aboutToShow()), this, SLOT(aboutToShow())); return; } @@ -177,20 +168,11 @@ void ModelMenu::createMenu(const QModelIndex &parent, int max, QMenu *parentMenu for (int i = 0; i < end; ++i) { QModelIndex idx = m_model->index(i, 0, parent); -// if (m_model->hasChildren(idx)) -// { -// createMenu(idx, -1, menu); -// } -// else -// { - if (m_separatorRole != 0 - && idx.data(m_separatorRole).toBool()) - addSeparator(); - else - menu->addAction(makeAction(idx)); -// } - if (menu == this && i == m_firstSeparator - 1) - addSeparator(); + + if( !m_model->hasChildren(idx) && ( m_separatorRole == 0 || !idx.data(m_separatorRole).toBool() ) ) + { + menu->addAction(makeAction(idx)); + } } } diff --git a/src/settings.cpp b/src/settings.cpp index dda00a0e..47339ce4 100644 --- a/src/settings.cpp +++ b/src/settings.cpp @@ -50,6 +50,7 @@ #include <KPageWidgetItem> #include <KFontDialog> #include <KUrl> +#include <KShortcutsEditor> // Qt Includes #include <QtCore/QPointer> @@ -108,6 +109,10 @@ Private::Private(SettingsDialog *parent) kWarning() << webkitIconPath; KIcon webkitIcon = KIcon(QIcon(webkitIconPath)); pageItem->setIcon(webkitIcon); + + widget = new KShortcutsEditor(Application::instance()->mainWindow()->actionCollection(),parent); + pageItem = parent->addPage(widget , i18n("Shortcuts")); + pageItem->setIcon(KIcon("configure-shortcuts")); } diff --git a/src/settings_general.ui b/src/settings_general.ui index d6ce4e49..90136755 100644 --- a/src/settings_general.ui +++ b/src/settings_general.ui @@ -99,7 +99,7 @@ <item> <widget class="QCheckBox" name="kcfg_showUrlsPopup"> <property name="text"> - <string>show urls in popup hovering links</string> + <string>Show URLs of links in a popup</string> </property> </widget> </item> diff --git a/src/webview.cpp b/src/webview.cpp index 101b6e06..a3682266 100644 --- a/src/webview.cpp +++ b/src/webview.cpp @@ -121,110 +121,115 @@ void WebView::contextMenuEvent(QContextMenuEvent *event) KMenu menu(this); QAction *a; - - // link actions + + bool linkIsEmpty = result.linkUrl().isEmpty(); + if (!linkIsEmpty) { + // link actions + a = pageAction(QWebPage::OpenLinkInNewWindow); a->setText(i18n("Open Link in New &Tab")); a->setIcon(KIcon("window-new")); menu.addAction(a); - } - else - { - menu.addAction(mainwindow->actionByName("new_tab")); - } - menu.addAction(mainwindow->actionByName("view_redisplay")); - menu.addSeparator(); - - // Developer Extras actions - if (page()->settings()->testAttribute(QWebSettings::DeveloperExtrasEnabled)) - { - a = pageAction(QWebPage::InspectElement); - a->setIcon(KIcon("view-process-all")); - menu.addAction(a); - menu.addSeparator(); - } - - // cut - copy - paste Actions. - bool b = false; - - if (result.isContentSelected() && result.isContentEditable()) - { - a = pageAction(QWebPage::Cut); - a->setIcon(KIcon("edit-cut")); - a->setShortcut(KStandardShortcut::cut().primary()); - menu.addAction(a); - b = true; - } - - if (result.isContentSelected()) - { - a = pageAction(QWebPage::Copy); - a->setIcon(KIcon("edit-copy")); - a->setShortcut(KStandardShortcut::copy().primary()); - menu.addAction(a); - b = true; - } - - if (result.isContentEditable()) - { - a = pageAction(QWebPage::Paste); - a->setIcon(KIcon("edit-paste")); - a->setShortcut(KStandardShortcut::paste().primary()); - menu.addAction(a); - b = true; - } - - if(b) - { - menu.addSeparator(); - } - // save/copy link actions - if (!linkIsEmpty) - { a = pageAction(QWebPage::DownloadLinkToDisk); a->setIcon(KIcon("document-save")); menu.addAction(a); - + a = pageAction(QWebPage::CopyLinkToClipboard); a->setIcon(KIcon("edit-copy")); menu.addAction(a); - menu.addSeparator(); - if (!result.pixmap().isNull()) { + menu.addSeparator(); + // TODO Add "View Image" && remove copy_this_image action - a = pageAction(QWebPage::DownloadImageToDisk); + a = pageAction(QWebPage::DownloadImageToDisk); a->setIcon(KIcon("document-save")); menu.addAction(a); a = pageAction(QWebPage::CopyImageToClipboard); a->setIcon(KIcon("edit-copy")); menu.addAction(a); - - menu.addSeparator(); } + } + else if (result.isContentEditable() && result.isContentSelected()) + { + // actions for text selected in field - // history actions - menu.addAction(mainwindow->actionByName("history_back")); - menu.addAction(mainwindow->actionByName("history_forward")); + a = pageAction(QWebPage::Cut); + a->setIcon(KIcon("edit-cut")); + a->setShortcut(KStandardShortcut::cut().primary()); + menu.addAction(a); - // bookmark link action - if (!linkIsEmpty) + a = pageAction(QWebPage::Copy); + a->setIcon(KIcon("edit-copy")); + a->setShortcut(KStandardShortcut::copy().primary()); + menu.addAction(a); + + a = pageAction(QWebPage::Paste); + a->setIcon(KIcon("edit-paste")); + a->setShortcut(KStandardShortcut::paste().primary()); + menu.addAction(a); + + // TODO Add translate, show translation + } + else if (result.isContentEditable()) { - menu.addSeparator(); - QAction *addBookmarkAction = Application::bookmarkProvider()->actionByName("rekonq_add_bookmark"); - menu.addAction(addBookmarkAction); + // actions for a not selected field or a void field + + //Warning: why it doesn't automatically select a field ? + //Why the paste action is disabled ? + + a = pageAction(QWebPage::Paste); + a->setIcon(KIcon("edit-paste")); + a->setShortcut(KStandardShortcut::paste().primary()); + menu.addAction(a); } + else if (result.isContentSelected()) + { + // actions for text selected in page + + a = pageAction(QWebPage::Copy); + a->setIcon(KIcon("edit-copy")); + a->setShortcut(KStandardShortcut::copy().primary()); + menu.addAction(a); - if(mainwindow->isFullScreen()) + // TODO Add search with google, wikipedia, show translation + } + else { - menu.addAction(mainwindow->actionByName("fullscreen")); + //page actions + + menu.addAction(mainwindow->actionByName("new_tab")); + if(mainwindow->isFullScreen()) + { + menu.addAction(mainwindow->actionByName("fullscreen")); + } + + menu.addSeparator(); + + menu.addAction(mainwindow->actionByName("history_back")); + menu.addAction(mainwindow->actionByName("history_forward")); + menu.addAction(mainwindow->actionByName("view_redisplay")); + + menu.addSeparator(); + + QAction *addBookmarkAction = Application::bookmarkProvider()->actionByName("rekonq_add_bookmark"); + menu.addAction(addBookmarkAction); + + if (page()->settings()->testAttribute(QWebSettings::DeveloperExtrasEnabled)) + { + // Developer Extras actions + + a = pageAction(QWebPage::InspectElement); + a->setIcon(KIcon("view-process-all")); + menu.addAction(a); + } } menu.exec(mapToGlobal(event->pos())); |