diff options
71 files changed, 1530 insertions, 750 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt index f46e42fb..0a4ec887 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -7,7 +7,7 @@ PROJECT( rekonq ) # Informations to update before to release this package. # rekonq info -SET(REKONQ_VERSION "0.4.70" ) +SET(REKONQ_VERSION "0.4.91" ) configure_file(${CMAKE_CURRENT_SOURCE_DIR}/version.h.cmake ${CMAKE_CURRENT_BINARY_DIR}/version.h ) @@ -1,3 +1,6 @@ +Please, refer to http://techbase.kde.org/Projects/rekonq/Roadmap page +to track all features available on new rekonq releases. + 0.4 - moved to kdewebkit (this means based on kde 4.4) - kwallet support @@ -30,4 +30,6 @@ then be found in build/src and is executed with ./rekonq. === Getting Help === -If you need help with rekonq, you can find it in the irc-channel #rekonq on freenode.
\ No newline at end of file +If you need help with rekonq, you can find it in the irc-channel #rekonq on irc.freenode.net or by viewing the Handbook that comes with rekonq. +You can view the rekonq Handbook by pressing F1 after starting rekonq. +Techbase page : http://techbase.kde.org/Projects/rekonq diff --git a/docs/automatic_filters.png b/docs/automatic_filters.png Binary files differindex a5c55beb..2378af00 100644 --- a/docs/automatic_filters.png +++ b/docs/automatic_filters.png diff --git a/docs/cache.png b/docs/cache.png Binary files differindex 19467578..80aa2165 100644 --- a/docs/cache.png +++ b/docs/cache.png diff --git a/docs/cookies.png b/docs/cookies.png Binary files differindex 0fe2cf3c..cf45c7ab 100644 --- a/docs/cookies.png +++ b/docs/cookies.png diff --git a/docs/fonts.png b/docs/fonts.png Binary files differindex a8f0f290..c8aeea52 100644 --- a/docs/fonts.png +++ b/docs/fonts.png diff --git a/docs/general.png b/docs/general.png Binary files differindex 8f0d8fb4..8c638380 100644 --- a/docs/general.png +++ b/docs/general.png diff --git a/docs/old_screenshot.png b/docs/old_screenshot.png Binary files differindex 5603f409..b168040d 100644 --- a/docs/old_screenshot.png +++ b/docs/old_screenshot.png diff --git a/docs/own_filter.png b/docs/own_filter.png Binary files differindex 21fd5489..f3f96d54 100644 --- a/docs/own_filter.png +++ b/docs/own_filter.png diff --git a/docs/proxy.png b/docs/proxy.png Binary files differindex 64cf0880..ceee5235 100644 --- a/docs/proxy.png +++ b/docs/proxy.png diff --git a/docs/screenshot.png b/docs/screenshot.png Binary files differindex ac9d9d76..b671bcb5 100644 --- a/docs/screenshot.png +++ b/docs/screenshot.png diff --git a/docs/shortcuts.png b/docs/shortcuts.png Binary files differindex f27c2f74..c6e6707a 100644 --- a/docs/shortcuts.png +++ b/docs/shortcuts.png diff --git a/docs/snapshot1.png b/docs/snapshot1.png Binary files differindex 2300d36b..788bf583 100644 --- a/docs/snapshot1.png +++ b/docs/snapshot1.png diff --git a/docs/tabs.png b/docs/tabs.png Binary files differindex aff84377..a1248466 100644 --- a/docs/tabs.png +++ b/docs/tabs.png diff --git a/docs/webkit.png b/docs/webkit.png Binary files differindex 62cff0e1..a1116d8f 100644 --- a/docs/webkit.png +++ b/docs/webkit.png diff --git a/docs/webshortcuts.png b/docs/webshortcuts.png Binary files differindex cc245d16..8e3dec06 100644 --- a/docs/webshortcuts.png +++ b/docs/webshortcuts.png diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index b79e64fa..d0e5721c 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -37,6 +37,10 @@ SET( rekonq_KDEINIT_SRCS #---------------------------------------- settings/settingsdialog.cpp settings/adblockwidget.cpp + settings/appearancewidget.cpp + settings/generalwidget.cpp + settings/tabswidget.cpp + settings/webkitwidget.cpp settings/networkwidget.cpp #---------------------------------------- bookmarks/bookmarksmanager.cpp @@ -64,7 +68,7 @@ SET( rekonq_KDEINIT_SRCS KDE4_ADD_UI_FILES( rekonq_KDEINIT_SRCS settings/settings_general.ui settings/settings_tabs.ui - settings/settings_fonts.ui + settings/settings_appearance.ui settings/settings_webkit.ui settings/settings_adblock.ui cleardata.ui diff --git a/src/Messages.sh b/src/Messages.sh index efa6adff..86f846c8 100644 --- a/src/Messages.sh +++ b/src/Messages.sh @@ -1,2 +1,5 @@ #! /bin/sh +$EXTRACTRC *.ui */*ui >> rc.cpp || exit 1 $XGETTEXT *.cpp */*.cpp -o $podir/rekonq.pot +rm -f rc.cpp + diff --git a/src/adblock/adblockmanager.cpp b/src/adblock/adblockmanager.cpp index 48e2369d..39432f88 100644 --- a/src/adblock/adblockmanager.cpp +++ b/src/adblock/adblockmanager.cpp @@ -114,6 +114,7 @@ void AdBlockManager::loadSettings(bool checkUpdateDate) void AdBlockManager::loadRules(const QStringList &rules) { + kDebug() << "LOADING RULES LIST..."; foreach(const QString &stringRule, rules) { // ! rules are comments @@ -259,15 +260,14 @@ void AdBlockManager::updateNextSubscription() void AdBlockManager::slotResult(KJob *job) { - kDebug() << "SLOTRESULT"; if (job->error()) return; + kDebug() << "SAVING RULES.."; QList<QByteArray> list = _buffer.split('\n'); QStringList ruleList; foreach(const QByteArray &ba, list) { - kDebug() << ba; ruleList << QString(ba); } loadRules(ruleList); @@ -282,7 +282,6 @@ void AdBlockManager::slotResult(KJob *job) void AdBlockManager::subscriptionData(KIO::Job* job, const QByteArray& data) { - kDebug() << "subscriptionData"; Q_UNUSED(job) if (data.isEmpty()) diff --git a/src/analyzer/networkanalyzer.cpp b/src/analyzer/networkanalyzer.cpp index 53972a9c..22a7c243 100644 --- a/src/analyzer/networkanalyzer.cpp +++ b/src/analyzer/networkanalyzer.cpp @@ -48,7 +48,7 @@ NetworkAnalyzer::NetworkAnalyzer(QWidget *parent) , _requestList(new QTreeWidget(this)) { QStringList headers; - headers << i18n("Method") << i18n("Url") << i18n("Response") << i18n("Length") << i18n("Content Type") << i18n("Info"); + headers << i18n("Method") << i18n("URL") << i18n("Response") << i18n("Length") << i18n("Content Type") << i18n("Info"); _requestList->setHeaderLabels( headers ); _requestList->header()->setResizeMode(0, QHeaderView::ResizeToContents); diff --git a/src/application.cpp b/src/application.cpp index 412999d8..9620feb8 100644 --- a/src/application.cpp +++ b/src/application.cpp @@ -336,7 +336,10 @@ void Application::loadUrl(const KUrl& url, const Rekonq::OpenType& type) // rapidly show first loading url.. - w->mainView()->urlBar()->setQUrl(url); + int tabIndex = w->mainView()->indexOf(tab); + Q_ASSERT( tabIndex != -1 ); + UrlBar *barForTab = qobject_cast<UrlBar *>(w->mainView()->widgetBar()->widget(tabIndex)); + barForTab->setQUrl(url); WebView *view = tab->view(); @@ -415,35 +418,46 @@ void Application::newWindow() void Application::updateConfiguration() { - // FIXME: - // all things related to mainview can be - // improved/moved/replicated in all the mainwindows - MainView *view = mainWindow()->mainView(); - - // ============== General ================== - view->updateTabBar(); - // ============== Tabs ================== - if (ReKonfig::closeTabSelectPrevious()) - view->tabBar()->setSelectionBehaviorOnRemove(QTabBar::SelectPreviousTab); - else - view->tabBar()->setSelectionBehaviorOnRemove(QTabBar::SelectRightTab); - - // =========== Fonts ============== - QWebSettings *defaultSettings = QWebSettings::globalSettings(); - - int fnSize = ReKonfig::fontSize(); - int minFnSize = ReKonfig::minFontSize(); + bool b = ReKonfig::closeTabSelectPrevious(); + Q_FOREACH(const QWeakPointer<MainWindow> &w, m_mainWindows) + { + MainView *mv = w.data()->mainView(); + mv->updateTabBar(); + + if (b) + mv->tabBar()->setSelectionBehaviorOnRemove(QTabBar::SelectPreviousTab); + else + mv->tabBar()->setSelectionBehaviorOnRemove(QTabBar::SelectRightTab); + } - QFont standardFont = ReKonfig::standardFont(); - defaultSettings->setFontFamily(QWebSettings::StandardFont, standardFont.family()); - defaultSettings->setFontSize(QWebSettings::DefaultFontSize, fnSize); - defaultSettings->setFontSize(QWebSettings::MinimumFontSize, minFnSize); + QWebSettings *defaultSettings = QWebSettings::globalSettings(); + + // =========== Fonts ============== + defaultSettings->setFontFamily(QWebSettings::StandardFont, ReKonfig::standardFontFamily() ); + defaultSettings->setFontFamily(QWebSettings::FixedFont, ReKonfig::fixedFontFamily() ); + defaultSettings->setFontFamily(QWebSettings::SerifFont, ReKonfig::serifFontFamily() ); + defaultSettings->setFontFamily(QWebSettings::SansSerifFont, ReKonfig::sansSerifFontFamily() ); + defaultSettings->setFontFamily(QWebSettings::CursiveFont, ReKonfig::cursiveFontFamily()); + defaultSettings->setFontFamily(QWebSettings::FantasyFont, ReKonfig::fantasyFontFamily()); + + // compute font size + // (I have to admit I know nothing about these DPI questions..: copied from kwebkitpart, as someone suggested) + // font size in pixels = font size in inches × screen dpi + int defaultFontSize = ReKonfig::defaultFontSize(); + int minimumFontSize = ReKonfig::minFontSize(); + + int logDpiY = mainWindow()->currentTab()->view()->logicalDpiY(); + kDebug() << "Logical Dot per Inch Y: " << logDpiY; + + float toPix = (logDpiY < 96.0) + ? 96.0/72.0 + : logDpiY/72.0 ; - QFont fixedFont = ReKonfig::fixedFont(); - defaultSettings->setFontFamily(QWebSettings::FixedFont, fixedFont.family()); - defaultSettings->setFontSize(QWebSettings::DefaultFixedFontSize, fnSize); + defaultSettings->setFontSize(QWebSettings::DefaultFontSize, qRound(defaultFontSize * toPix) ); + defaultSettings->setFontSize(QWebSettings::MinimumFontSize, qRound(minimumFontSize * toPix) ); + // ================ WebKit ============================ defaultSettings->setAttribute(QWebSettings::AutoLoadImages, ReKonfig::autoLoadImages()); defaultSettings->setAttribute(QWebSettings::DnsPrefetchEnabled, ReKonfig::dnsPrefetch()); diff --git a/src/bookmarks/bookmarkcontextmenu.cpp b/src/bookmarks/bookmarkcontextmenu.cpp index 47608710..4422763a 100644 --- a/src/bookmarks/bookmarkcontextmenu.cpp +++ b/src/bookmarks/bookmarkcontextmenu.cpp @@ -213,11 +213,12 @@ void BookmarkContextMenu::deleteBookmark() { KBookmark bm = bookmark(); bool folder = bm.isGroup(); + QString name = QString(bm.text()).replace("&&", "&"); if (KMessageBox::warningContinueCancel( QApplication::activeWindow(), - folder ? i18n("Are you sure you wish to remove the bookmark folder\n\"%1\"?", bm.text()) - : i18n("Are you sure you wish to remove the bookmark\n\"%1\"?", bm.text()), + folder ? i18n("Are you sure you wish to remove the bookmark folder\n\"%1\"?", name) + : i18n("Are you sure you wish to remove the bookmark\n\"%1\"?", name), folder ? i18n("Bookmark Folder Deletion") : i18n("Bookmark Deletion"), KStandardGuiItem::del()) @@ -233,9 +234,10 @@ void BookmarkContextMenu::deleteBookmark() void BookmarkContextMenu::editBookmark() { KBookmark selected = bookmark(); - + selected.setFullText(selected.text().replace("&&", "&")); KBookmarkDialog *dialog = owner()->bookmarkDialog(manager(), QApplication::activeWindow()); dialog->editBookmark(selected); + selected.setFullText(selected.text().replace('&', "&&")); delete dialog; } @@ -317,7 +319,7 @@ void BookmarkContextMenu::bookmarkCurrentPage() if (selected.isGroup()) parent = selected.toGroup(); - KBookmark newBk = parent.addBookmark(owner()->currentTitle(), KUrl(owner()->currentUrl()), "text-html"); + KBookmark newBk = parent.addBookmark(owner()->currentTitle().replace('&', "&&"), KUrl(owner()->currentUrl()), "text-html"); parent.moveBookmark(newBk, selected.parentGroup().previous(selected)); } diff --git a/src/bookmarks/bookmarksmanager.cpp b/src/bookmarks/bookmarksmanager.cpp index 03146ea2..c430078b 100644 --- a/src/bookmarks/bookmarksmanager.cpp +++ b/src/bookmarks/bookmarksmanager.cpp @@ -100,8 +100,10 @@ void BookmarkOwner::openFolderinTabs(const KBookmarkGroup &bookmark) if (urlList.length() > 8) { if ( !(KMessageBox::warningContinueCancel( Application::instance()->mainWindow(), - i18n("You are about to open %1 tabs.\nAre you sure ?", - QString::number( urlList.length() )) + i18ncp("%1=Number of tabs. Value is always >=8", + "You are about to open %1 tabs.\nAre you sure?", + "You are about to open %1 tabs.\nAre you sure?", + urlList.length()) ) == KMessageBox::Continue) ) return; @@ -409,7 +411,9 @@ void BookmarkProvider::fillBookmarkBar(KToolBar *toolBar) else { - toolBar->addAction(new KBookmarkAction(bookmark, m_owner, this)); + KBookmarkAction* a = new KBookmarkAction(bookmark, m_owner, this); + a->setIconText(a->iconText().replace('&', "&&")); + toolBar->addAction(a); } } } diff --git a/src/bookmarks/bookmarkstreemodel.cpp b/src/bookmarks/bookmarkstreemodel.cpp index 06732007..a865a99d 100644 --- a/src/bookmarks/bookmarkstreemodel.cpp +++ b/src/bookmarks/bookmarkstreemodel.cpp @@ -75,7 +75,7 @@ QVariant BtmItem::data(int role) const } if (m_kbm.isGroup()) { - tooltip += " [" + QString::number(childCount()) + ' ' + i18n("Items") + ']'; + tooltip += i18nc("%1=Number of items in bookmark folder", " (%1 items)", childCount()); } if (!m_kbm.url().url().isEmpty()) { diff --git a/src/clicktoflash.cpp b/src/clicktoflash.cpp index e9174470..051919fd 100644 --- a/src/clicktoflash.cpp +++ b/src/clicktoflash.cpp @@ -93,7 +93,6 @@ void ClickToFlash::load() { if (checkElement(element)) { - kDebug() << "RETURNED TRUE ..........................."; QWebElement substitute = element.clone(); emit signalLoadClickToFlash(true); element.replace(substitute); @@ -108,6 +107,7 @@ void ClickToFlash::load() bool ClickToFlash::checkElement(QWebElement el) { + // check these two values.. kDebug() << "src: " << QUrl(el.attribute("src")); kDebug() << "url: " << m_url; diff --git a/src/data/home.html b/src/data/home.html index 25236743..cedd8855 100644 --- a/src/data/home.html +++ b/src/data/home.html @@ -40,9 +40,7 @@ font: normal bold 1em; a { color: #3F7AB7; text-decoration: none; --webkit-transition-property: color; --webkit-transition-duration: 0.5s; --webkit-transition-timing-function: ease; +-webkit-transition: color 0.5s ease; } a:hover { color: black; @@ -81,7 +79,12 @@ height: 16px; .link { display: inline-block; +-webkit-transition: opacity 0.5s ease; } +.link:not(.current):hover { +opacity: 0.6; +} + .link img, .link span { vertical-align: middle; display: inline-block; } @@ -89,15 +92,6 @@ vertical-align: middle; display: inline-block; color: black; } -#actions .link { --webkit-transition-property: opacity; --webkit-transition-duration: 0.8s; --webkit-transition-timing-function: ease; -opacity: 0.2; -} -#actions .link:hover { -opacity: 1; -} #actions .link img { margin-right: 3px; width: 16px; } @@ -141,22 +135,13 @@ background: url(%2/bg.png) no-repeat; padding: 0 12px; } -.thumbnail:hover .preview , -.thumbnail:hover .button img { -opacity: 0.8; -} -.button img, .preview { --webkit-transition-property: opacity; --webkit-transition-duration: 0.8s; --webkit-transition-timing-function: ease-in-out; -} - .button img { display: inline-block; width: 16px; height: 16px; opacity: 0; } + .remove { float: right; } @@ -164,7 +149,20 @@ float: right; float: left; } -.thumbnail a:hover, .thumbnail span { +.button img, .preview { +-webkit-transition: opacity 0.8s ease-in-out; +} +.thumb-inner:hover .preview { +opacity: 0.6; +} +.thumb-inner:hover .button img { +opacity: 0.4; +-webkit-transition: opacity 0.8s ease-out; +} +.thumb-inner .button img:hover { +opacity: 1; +} +.thumbnail a:hover { color:#3F7AB7; } diff --git a/src/data/rekonq.desktop b/src/data/rekonq.desktop index a4eb1b00..e4157082 100644 --- a/src/data/rekonq.desktop +++ b/src/data/rekonq.desktop @@ -2,21 +2,39 @@ Name=rekonq Name[cs]=rekonq Name[da]=rekonq +Name[de]=rekonq +Name[en_GB]=rekonq +Name[es]=rekonq +Name[et]=rekonq +Name[fr]=rekonq +Name[ga]=rekonq Name[it]=rekonq +Name[lt]=rekonq Name[nds]=Rekonq +Name[nl]=rekonq +Name[pl]=rekonq Name[pt]=rekonq Name[pt_BR]=rekonq +Name[ru]=rekonq Name[sv]=Rekonq Name[uk]=rekonq Name[x-test]=xxrekonqxx Name[zh_CN]=rekonq +Name[zh_TW]=rekonq GenericName=WebKit KDE Browser GenericName[da]=KDE-browser baseret på WebKit +GenericName[de]=WebKit-basierter Webbrowser für KDE +GenericName[en_GB]=WebKit KDE Browser +GenericName[et]=KDE WebKiti veebibrauser +GenericName[fr]=Navigateur Webkit pour KDE +GenericName[nl]=Webkit KDE Browser GenericName[pt]=Navegador do KDE Usando o WebKit GenericName[pt_BR]=Navegador WebKit do KDE +GenericName[ru]=Веб-браузер для KDE на базе WebKit GenericName[sv]=Webkit webbläsare för KDE GenericName[uk]=Переглядач мережі на WebKit для KDE GenericName[x-test]=xxWebKit KDE Browserxx +GenericName[zh_CN]=Webkit KDE 浏览器 Icon=rekonq Type=Application Exec=rekonq %u diff --git a/src/history/historymanager.cpp b/src/history/historymanager.cpp index 8a29aa90..c0f87935 100644 --- a/src/history/historymanager.cpp +++ b/src/history/historymanager.cpp @@ -468,7 +468,7 @@ void HistoryManager::addDownload(const QString &srcUrl, const QString &destUrl) QFile downloadFile(downloadFilePath); if (!downloadFile.open(QFile::WriteOnly | QFile::Append)) { - kDebug() << "azz..."; + kDebug() << "Unable to open download file (WRITE mode).."; return; } QDataStream out(&downloadFile); @@ -487,7 +487,7 @@ DownloadList HistoryManager::downloads() QFile downloadFile(downloadFilePath); if (!downloadFile.open(QFile::ReadOnly)) { - kDebug() << "azz..."; + kDebug() << "Unable to open download file (READ mode).."; return list; } diff --git a/src/history/historypanel.cpp b/src/history/historypanel.cpp index c8009afd..d8309eed 100644 --- a/src/history/historypanel.cpp +++ b/src/history/historypanel.cpp @@ -172,8 +172,10 @@ void HistoryPanel::openAll() if (allChild.length() > 8) { if (!(KMessageBox::warningContinueCancel(this, - i18n("You are about to open %1 tabs.\nAre you sure ?", - QString::number(allChild.length()))) == KMessageBox::Continue) + i18ncp("%1=Number of tabs. Value is always >=8", + "You are about to open %1 tabs.\nAre you sure?", + "You are about to open %1 tabs.\nAre you sure?", + allChild.length())) == KMessageBox::Continue) ) return; } diff --git a/src/main.cpp b/src/main.cpp index 5551c55a..296f8679 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -66,34 +66,64 @@ extern "C" KDE_EXPORT int kdemain(int argc, char **argv) ""); about.addAuthor(ki18n("Lionel Chauvin"), - ki18n("Developer, Ideas, Mockups. And the icon."), + ki18n("Developer, Ideas, Mockups, rekonq Icon"), "megabigbug@yahoo.fr", ""); - + about.addAuthor(ki18n("Johannes Zellner"), - ki18n("Patches, suggestions, testing, bugfixing"), + ki18n("Patches, Suggestions, Testing, Bugfixing"), "webmaster@nebulon.de", ""); about.addAuthor(ki18n("Matthieu Gicquel"), - ki18n("Developer, Ideas, Tabloid improvements"), + ki18n("Developer, Ideas, New Tab Page improvements"), "matgic78@gmail.com", ""); about.addAuthor(ki18n("Ronny Scholz"), - ki18n("(Tons of ) patches, testing, bugfixing"), + ki18n("(Tons of) Patches, Testing, Bugfixing"), "ronny_scholz@web.de", ""); + about.addAuthor(ki18n("Yoann Laissus"), + ki18n("Developer, History & Bookmarks Improvements"), + "yoann.laissus@gmail.com", + ""); + + about.addAuthor(ki18n("Cédric Bellegarde"), + ki18n("Patched code quite everywhere :)"), + "gnumdk@adishatz.1s.fr", + ""); + + about.addAuthor(ki18n("Nikhil Marathe"), + ki18n("Bugfixing, Working on Extensions support (not yet available)"), + "nsm.nikhil@gmail.com", + ""); + + about.addAuthor(ki18n("Rohan Garg"), + ki18n("Handbook, Maintains a Kubuntu PPA with rekonq git packages"), + "rohan16garg@gmail.com", + ""); + + about.addAuthor(ki18n("Jonathan Raphael Joachim Kolberg"), + ki18n("Handbook, Maintains a Kubuntu PPA with rekonq git packages"), + "bulldog98@freenet.de", + ""); + // --------------- about credits ----------------------------- - about.addCredit(ki18n("Domrachev Alexandr"), - ki18n("Developer"), - "alexandr.domrachev@gmail.com", + about.addCredit(ki18n("Lindsay Mathieson"), + ki18n("Provided Patches & Hints, Discovered Bugs"), + "lindsay.mathieson@gmail.com", + ""); + + about.addCredit(ki18n("Abdurrahman AVCI"), + ki18n("Provided Patches & Hints"), + "abdurrahmanavci@gmail.com", ""); - about.addCredit(ki18n("Henry de Valence"), - ki18n("Promised help on multitask rekonq"), - "hdevalence@gmail.com", + about.addCredit(ki18n("Domrachev Alexandr"), + ki18n("Former Developer"), + "alexandr.domrachev@gmail.com", ""); about.addCredit(ki18n("Abuus"), @@ -102,32 +132,27 @@ extern "C" KDE_EXPORT int kdemain(int argc, char **argv) ""); about.addCredit(ki18n("Ivan Čukić"), - ki18n("Patches, bugfixing and ideas"), + ki18n("Patches, Bugfixing and Ideas"), "ivan@fomentgroup.org", ""); about.addCredit(ki18n("Adrià Arrufat"), - ki18n("New tab loading animation"), + ki18n("New Tab Page loading animation"), "swiftscythe@gmail.com", ""); about.addCredit(ki18n("Pawel Prazak"), - ki18n("Developer"), + ki18n("Former Developer"), "kojots350@gmail.com", ""); - about.addCredit(ki18n("Rohan Garg"), - ki18n("Handbook"), - "rohan16garg@gmail.com", - ""); - about.addCredit(ki18n("Dario Freddi"), - ki18n("Patches, hints, first KWallet support implementation (not yet included)"), + ki18n("Patches, Hints, First implementation of KWallet support"), "drf@kde.org", ""); about.addCredit(ki18n("Jon de Andrés Frías"), - ki18n("first awesome bar implementation (wait next version and you'll see..)"), + ki18n("First awesome bar implementation"), "jondeandres@gmail.com", ""); diff --git a/src/mainview.cpp b/src/mainview.cpp index 1c36adcf..0b17ef2a 100644 --- a/src/mainview.cpp +++ b/src/mainview.cpp @@ -329,6 +329,7 @@ WebTab *MainView::newWebTab(bool focused, bool nearParent) connect(tab->view(), SIGNAL(iconChanged()), this, SLOT(webViewIconChanged())); connect(tab->view(), SIGNAL(titleChanged(const QString &)), this, SLOT(webViewTitleChanged(const QString &))); connect(tab->view(), SIGNAL(urlChanged(const QUrl &)), this, SLOT(webViewUrlChanged(const QUrl &))); + connect(tab->view(), SIGNAL(zoomChanged(qreal)), m_parentWindow, SLOT(setZoomSliderFactor(qreal))); // connecting webPage signals with mainview connect(tab->view()->page(), SIGNAL(windowCloseRequested()), this, SLOT(windowCloseRequested())); @@ -512,6 +513,8 @@ void MainView::closeTab(int index, bool del) UrlBar *urlbar = _widgetBar->urlBar(index); _widgetBar->removeWidget(urlbar); + _widgetBar->setCurrentIndex(m_currentTabIndex); + if (del) { tab->deleteLater(); // tab is scheduled for deletion. @@ -592,11 +595,10 @@ void MainView::webViewIconChanged() void MainView::webViewTitleChanged(const QString &title) { - QString tabTitle = title; - if (title.isEmpty()) - { - tabTitle = i18n("(Untitled)"); - } + QString viewTitle = title.isEmpty()? i18n("(Untitled)") : title; + QString tabTitle = viewTitle; + tabTitle.replace('&', "&&"); + WebView *view = qobject_cast<WebView *>(sender()); int index = indexOf(view->parentWidget()); if (-1 != index) @@ -605,7 +607,7 @@ void MainView::webViewTitleChanged(const QString &title) } if (currentIndex() == index) { - emit currentTitle(tabTitle); + emit currentTitle(viewTitle); } Application::historyManager()->updateHistoryEntry(view->url(), tabTitle); } @@ -657,6 +659,17 @@ void MainView::openClosedTab() } } +void MainView::switchToTab() +{ + // uses the sender to determine the tab index + QAction *sender = static_cast<QAction*>(QObject::sender()); + int index = sender->data().toInt(); + index -= 1; // to compensate for off by 1 presented to the user + if( index < 0 || index >= count() ) + return; + setCurrentIndex( index ); +} + QLabel *MainView::animatedLoading(int index, bool addMovie) { if (index == -1) diff --git a/src/mainview.h b/src/mainview.h index 0cff4c81..636d37ac 100644 --- a/src/mainview.h +++ b/src/mainview.h @@ -135,6 +135,7 @@ public slots: void detachTab(int index = -1); void openClosedTabs(); void openClosedTab(); + void switchToTab(); // WEB slot actions void webReload(); diff --git a/src/mainwindow.cpp b/src/mainwindow.cpp index 2287370c..dc29d2eb 100644 --- a/src/mainwindow.cpp +++ b/src/mainwindow.cpp @@ -320,7 +320,9 @@ void MainWindow::setupActions() browserLoading(false); //first init for blank start page a = new KAction(i18n("Open Location"), this); - a->setShortcut(Qt::CTRL + Qt::Key_L); + KShortcut openLocationShortcut(Qt::CTRL + Qt::Key_L); + openLocationShortcut.setAlternate(Qt::Key_F6); + a->setShortcut(openLocationShortcut); actionCollection()->addAction(QL1S("open_location"), a); connect(a, SIGNAL(triggered(bool)) , this, SLOT(openLocation())); @@ -398,6 +400,16 @@ void MainWindow::setupActions() closedTabsMenu->setDelayed(false); actionCollection()->addAction(QL1S("closed_tab_menu"), closedTabsMenu); + // shortcuts for quickly switching to a tab + for( int i = 1; i <= 9; i++ ) { + a = new KAction(i18n("Switch to Tab %1", i), this); + a->setShortcut(KShortcut( QString("Alt+%1").arg(i) )); + a->setData( QVariant(i) ); + actionCollection()->addAction(QL1S(("switch_tab_" + QString::number(i)).toAscii()), a); + connect(a, SIGNAL(triggered(bool)), m_view, SLOT(switchToTab())); + } + + // ============================== Indexed Tab Actions ==================================== a = new KAction(KIcon("tab-close"), i18n("&Close Tab"), this); actionCollection()->addAction(QL1S("close_tab"), a); @@ -597,8 +609,19 @@ void MainWindow::openLocation() void MainWindow::fileSaveAs() { - KUrl srcUrl = currentTab()->url(); - + KUrl srcUrl; + WebTab *w = currentTab(); + if (w->page()->isOnRekonqPage()) + { + QWebElement el = w->page()->mainFrame()->documentElement(); + srcUrl = KUrl( el.findFirst("object").attribute("data") ); + } + else + { + srcUrl = w->url(); + } + kDebug() << "URL to save: " << srcUrl; + QString name = srcUrl.fileName(); if (name.isNull()) { @@ -634,7 +657,6 @@ void MainWindow::preferences() void MainWindow::updateActions() { bool rekonqPage = currentTab()->page()->isOnRekonqPage(); - kDebug() << "UPDATE ACTIONS: rekonq page = " << rekonqPage; QAction *historyBackAction = actionByName(KStandardAction::name(KStandardAction::Back)); if( rekonqPage ) @@ -658,7 +680,7 @@ void MainWindow::updateActions() if (am->menu()) am->menu()->clear(); - foreach (HistoryItem item, mainView()->recentlyClosedTabs()) + foreach (const HistoryItem &item, mainView()->recentlyClosedTabs()) { KAction *a = new KAction(Application::icon(item.url), item.title, this); a->setData(item.url); @@ -884,7 +906,7 @@ void MainWindow::setZoomFactor(int factor) void MainWindow::setZoomSliderFactor(qreal factor) { - m_zoomSlider->setValue(factor*10); + m_zoomSlider->setValue(factor * 10); } @@ -942,26 +964,8 @@ void MainWindow::viewPageSource() if (!currentTab()) return; - KUrl url(currentTab()->url()); - bool isTempFile = false; - if (!url.isLocalFile()) - { - KTemporaryFile sourceFile; - - /// TODO: autochoose tempfile suffix - sourceFile.setSuffix(QString(".html")); - sourceFile.setAutoRemove(false); - - if (sourceFile.open()) - { - sourceFile.write(currentTab()->page()->mainFrame()->toHtml().toUtf8()); - - url = KUrl(); - url.setPath(sourceFile.fileName()); - isTempFile = true; - } - } - KRun::runUrl(url, QL1S("text/plain"), this, isTempFile); + KUrl url = currentTab()->url(); + KRun::runUrl(url, QL1S("text/plain"), this, false); } @@ -1314,7 +1318,7 @@ void MainWindow::setEncoding(QAction *qa) { QString currentCodec = qa->text().toLatin1(); currentCodec = currentCodec.remove('&'); - kDebug() << currentCodec; + kDebug() << "Setting codec: " << currentCodec; currentTab()->page()->settings()->setDefaultTextEncoding(currentCodec); } @@ -1331,7 +1335,6 @@ void MainWindow::populateEncodingMenu() codecs.sort(); QString currentCodec = currentTab()->page()->settings()->defaultTextEncoding(); - kDebug() << "Current Codec: " << currentCodec; m_encodingMenu->clear(); KMenu *isoMenu = new KMenu( QL1S("ISO"), m_encodingMenu); @@ -1380,8 +1383,8 @@ bool MainWindow::queryClose() { int answer = KMessageBox::questionYesNoCancel( this, - i18np("Are you sure you want to close the window?\n" "You have 1 tab open", - "Are you sure you want to close the window?\n" "You have %1 tabs open" , + i18np("Are you sure you want to close the window?\n" "You have 1 tab open.", + "Are you sure you want to close the window?\n" "You have %1 tabs open.", m_view->count()), i18n("Are you sure you want to close the window?"), KStandardGuiItem::quit(), diff --git a/src/mainwindow.h b/src/mainwindow.h index ffc91086..8acbef56 100644 --- a/src/mainwindow.h +++ b/src/mainwindow.h @@ -78,8 +78,6 @@ public: virtual QSize sizeHint() const; void setWidgetsVisible(bool makeFullScreen); - void setZoomSliderFactor(qreal factor); - private: void setupActions(); void setupTools(); @@ -103,6 +101,8 @@ public slots: void updateActions(); + void setZoomSliderFactor(qreal factor); + signals: // switching tabs void ctrlTabPressed(); diff --git a/src/newtabpage.cpp b/src/newtabpage.cpp index b3b9cf65..9c381f97 100644 --- a/src/newtabpage.cpp +++ b/src/newtabpage.cpp @@ -380,8 +380,7 @@ void NewTabPage::browsingMenu(const KUrl ¤tUrl) nav.findFirst("span").appendInside(i18n("Downloads")); navItems.append(nav); - QWebElement it; - foreach(it, navItems) + foreach(QWebElement it, navItems) { if (it.findFirst("a").attribute("href") == currentUrl.toMimeDataString()) it.addClass("current"); @@ -582,7 +581,7 @@ void NewTabPage::downloadsPage() div.appendInside("<em>" + date + "</em>"); div.appendInside("<br/>"); - div.appendInside(item.srcUrlString); + div.appendInside("<a href=" + item.srcUrlString + '>' + item.srcUrlString + "</a>"); div.appendInside("<br/>"); div.appendInside(markup("a")); diff --git a/src/protocolhandler.cpp b/src/protocolhandler.cpp index 3a9d61ef..568aa400 100644 --- a/src/protocolhandler.cpp +++ b/src/protocolhandler.cpp @@ -339,7 +339,7 @@ void ProtocolHandler::slotMostLocalUrlResult(KJob *job) */ void ProtocolHandler::abpHandling() { - kDebug() << _url; + kDebug() << "handling abp url: " << _url; QString path = _url.path(); if (path != QL1S("subscribe")) @@ -348,16 +348,9 @@ void ProtocolHandler::abpHandling() QMap<QString, QString> map = _url.queryItems(KUrl::CaseInsensitiveKeys); QString location = map.value(QL1S("location")); - kDebug() << location; - QString title = map.value(QL1S("title")); - kDebug() << title; - QString requireslocation = map.value(QL1S("requireslocation")); - kDebug() << requireslocation; - QString requirestitle = map.value(QL1S("requirestitle")); - kDebug() << requirestitle; QString info; if (requirestitle.isEmpty() || requireslocation.isEmpty()) diff --git a/src/rekonq.kcfg b/src/rekonq.kcfg index 6769b4f5..1d6139ac 100644 --- a/src/rekonq.kcfg +++ b/src/rekonq.kcfg @@ -9,6 +9,7 @@ <include>QtWebKit</include> <include>QDateTime</include> <include>KUrl</include> +<include>KGlobalSettings</include> <kcfgfile name="rekonqrc" /> @@ -69,8 +70,8 @@ <entry name="searchEngine" type="Int"> <default>0</default> </entry> - <entry name="disableAutoScroll" type="Bool"> - <default>false</default> + <entry name="autoScroll" type="Bool"> + <default>true</default> </entry> </group> @@ -100,17 +101,29 @@ <!-- Fonts Settings --> <group name="Fonts"> - <entry name="standardFont" type="Font"> - <default code="true">QFont(QWebSettings::globalSettings()->fontFamily(QWebSettings::StandardFont))</default> + <entry name="standardFontFamily" type="String"> + <default code="true">KGlobalSettings::generalFont().family()</default> + </entry> + <entry name="fixedFontFamily" type="String"> + <default code="true">KGlobalSettings::fixedFont().family()</default> + </entry> + <entry name="serifFontFamily" type="String"> + <default code="true">QWebSettings::globalSettings()->fontFamily(QWebSettings::SerifFont)</default> </entry> - <entry name="fixedFont" type="Font"> - <default code="true">QFont(QWebSettings::globalSettings()->fontFamily(QWebSettings::FixedFont))</default> + <entry name="sansSerifFontFamily" type="String"> + <default code="true">QWebSettings::globalSettings()->fontFamily(QWebSettings::SansSerifFont)</default> </entry> - <entry name="fontSize" type="Int"> - <default>16</default> + <entry name="cursiveFontFamily" type="String"> + <default code="true">QWebSettings::globalSettings()->fontFamily(QWebSettings::CursiveFont)</default> + </entry> + <entry name="fantasyFontFamily" type="String"> + <default code="true">QWebSettings::globalSettings()->fontFamily(QWebSettings::FantasyFont)</default> + </entry> + <entry name="defaultFontSize" type="Int"> + <default>12</default> </entry> <entry name="minFontSize" type="Int"> - <default>8</default> + <default>7</default> </entry> </group> diff --git a/src/sessionmanager.cpp b/src/sessionmanager.cpp index 97d9bc36..6eb0cb6c 100644 --- a/src/sessionmanager.cpp +++ b/src/sessionmanager.cpp @@ -110,33 +110,34 @@ bool SessionManager::restoreSession() if (line == QString("window")) { line = in.readLine(); - kDebug() << "New Window line: " << line; Application::instance()->loadUrl( KUrl(line), Rekonq::NewWindow); } - else if (line == QString("currenttab")) - { - kDebug() << "Set Current Tab Line" << endl; - line = in.readLine(); - bool ok; - int idx = line.toInt(&ok); - if (ok) - { - kDebug() << "Setting current tab to " << idx << endl; - // Get last mainwindow created which will be first one in mainwindow list - MainWindowList wl = Application::instance()->mainWindowList(); - if (wl.count() > 0) - { - MainView *mv = wl[0].data()->mainView(); - emit mv->tabBar()->setCurrentIndex(idx); - } - } - else - kDebug() << "Failed to convert currenttab index line <" << line << "> to in value" << endl; - } else { - kDebug() << "New Current Tab line: " << line; - Application::instance()->loadUrl( KUrl(line), Rekonq::NewCurrentTab); + if (line == QString("currenttab")) + { + line = in.readLine(); + bool ok; + int idx = line.toInt(&ok); + if (ok) + { + // Get last mainwindow created which will be first one in mainwindow list + MainWindowList wl = Application::instance()->mainWindowList(); + if (wl.count() > 0) + { + MainView *mv = wl[0].data()->mainView(); + emit mv->tabBar()->setCurrentIndex(idx); + } + } + else + { + kDebug() << "Failed to convert currenttab index line <" << line << "> to in value" << endl; + } + } + else + { + Application::instance()->loadUrl( KUrl(line), Rekonq::NewCurrentTab); + } } } while (!line.isEmpty()); diff --git a/src/settings/adblockwidget.h b/src/settings/adblockwidget.h index 1ed9aaa6..38a02636 100644 --- a/src/settings/adblockwidget.h +++ b/src/settings/adblockwidget.h @@ -32,8 +32,8 @@ #include "ui_settings_adblock.h" // Qt Includes -#include <QWidget> -#include <QTreeWidgetItem> +#include <QtGui/QWidget> +#include <QtGui/QTreeWidgetItem> class AdBlockWidget : public QWidget, private Ui::adblock diff --git a/src/settings/appearancewidget.cpp b/src/settings/appearancewidget.cpp new file mode 100644 index 00000000..20793d0a --- /dev/null +++ b/src/settings/appearancewidget.cpp @@ -0,0 +1,121 @@ +/* ============================================================ +* +* This file is a part of the rekonq project +* +* Copyright (C) 2010 by Andrea Diamantini <adjam7 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/>. +* +* ============================================================ */ + + +// Self Includes +#include "appearancewidget.h" +#include "appearancewidget.moc" + +// Auto Includes +#include "rekonq.h" + + +AppearanceWidget::AppearanceWidget(QWidget *parent) + : QWidget(parent) + , _changed(false) +{ + setupUi(this); + + fixedFontChooser->setOnlyFixed(true); + + standardFontChooser->setCurrentFont( QFont( ReKonfig::standardFontFamily() ) ); + fixedFontChooser->setCurrentFont( QFont( ReKonfig::fixedFontFamily() ) ); + serifFontChooser->setCurrentFont( QFont( ReKonfig::serifFontFamily() ) ); + sansSerifFontChooser->setCurrentFont( QFont( ReKonfig::sansSerifFontFamily() ) ); + cursiveFontChooser->setCurrentFont( QFont( ReKonfig::cursiveFontFamily() ) ); + fantasyFontChooser->setCurrentFont( QFont( ReKonfig::fantasyFontFamily() ) ); + + connect(standardFontChooser, SIGNAL(currentFontChanged(const QFont &)), this, SLOT(slotStandardFont(const QFont &))); + connect(fixedFontChooser, SIGNAL(currentFontChanged(const QFont &)), this, SLOT(slotFixedFont(const QFont &))); + connect(serifFontChooser, SIGNAL(currentFontChanged(const QFont &)), this, SLOT(slotSerifFont(const QFont &))); + connect(sansSerifFontChooser, SIGNAL(currentFontChanged(const QFont &)), this, SLOT(slotSansSerifFont(const QFont &))); + connect(cursiveFontChooser, SIGNAL(currentFontChanged(const QFont &)), this, SLOT(slotCursiveFont(const QFont &))); + connect(fantasyFontChooser, SIGNAL(currentFontChanged(const QFont &)), this, SLOT(slotFantasyFont(const QFont &))); +} + + +void AppearanceWidget::save() +{ + ReKonfig::setStandardFontFamily(reFont[0]); + ReKonfig::setFixedFontFamily(reFont[1]); + ReKonfig::setSerifFontFamily(reFont[2]); + ReKonfig::setSansSerifFontFamily(reFont[3]); + ReKonfig::setCursiveFontFamily(reFont[4]); + ReKonfig::setFantasyFontFamily(reFont[5]); +} + + +bool AppearanceWidget::changed() +{ + return _changed; +} + + +void AppearanceWidget::hasChanged() +{ + _changed = true; +} + + +void AppearanceWidget::slotStandardFont(const QFont &f) +{ + reFont[0] = f.family(); + hasChanged(); +} + + +void AppearanceWidget::slotFixedFont(const QFont &f) +{ + reFont[1] = f.family(); + hasChanged(); +} + + +void AppearanceWidget::slotSerifFont(const QFont &f) +{ + reFont[2] = f.family(); + hasChanged(); +} + + +void AppearanceWidget::slotSansSerifFont(const QFont &f) +{ + reFont[3] = f.family(); + hasChanged(); +} + + +void AppearanceWidget::slotCursiveFont(const QFont &f) +{ + reFont[4] = f.family(); + hasChanged(); +} + + +void AppearanceWidget::slotFantasyFont(const QFont &f) +{ + reFont[5] = f.family(); + hasChanged(); +} diff --git a/src/settings/appearancewidget.h b/src/settings/appearancewidget.h new file mode 100644 index 00000000..ea3de6a1 --- /dev/null +++ b/src/settings/appearancewidget.h @@ -0,0 +1,71 @@ +/* ============================================================ +* +* This file is a part of the rekonq project +* +* Copyright (C) 2010 by Andrea Diamantini <adjam7 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 APPEARANCE_WIDGET_H +#define APPEARANCE_WIDGET_H + + +// Rekonq Includes +#include "rekonq_defines.h" + +// Ui Includes +#include "ui_settings_appearance.h" + +// Qt Includes +#include <QtGui/QWidget> + + +class AppearanceWidget : public QWidget, private Ui::appearance +{ + Q_OBJECT + +public: + AppearanceWidget(QWidget *parent = 0); + + void save(); + bool changed(); + +signals: + void changed(bool); + +private slots: + void hasChanged(); + + void slotStandardFont(const QFont &); + void slotFixedFont(const QFont &); + void slotSerifFont(const QFont &); + void slotSansSerifFont(const QFont &); + void slotCursiveFont(const QFont &); + void slotFantasyFont(const QFont &); + +private: + bool _changed; + + QString reFont[6]; + +}; + +#endif // APPEARANCE_WIDGET_H diff --git a/src/settings/generalwidget.cpp b/src/settings/generalwidget.cpp new file mode 100644 index 00000000..09c9e5c7 --- /dev/null +++ b/src/settings/generalwidget.cpp @@ -0,0 +1,85 @@ +/* ============================================================ +* +* This file is a part of the rekonq project +* +* Copyright (C) 2010 by Andrea Diamantini <adjam7 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/>. +* +* ============================================================ */ + + +// Self Includes +#include "generalwidget.h" +#include "generalwidget.moc" + +// Auto Includes +#include "rekonq.h" + +// Local Includes +#include "application.h" +#include "mainwindow.h" +#include "webtab.h" + + +GeneralWidget::GeneralWidget(QWidget *parent) + : QWidget(parent) + , _changed(false) +{ + setupUi(this); + + connect(setHomeToCurrentPageButton, SIGNAL(clicked()), this, SLOT(setHomeToCurrentPage())); + + disableHomeSettings(ReKonfig::useNewTabPage()); + + connect(kcfg_useNewTabPage, SIGNAL(toggled(bool)), this, SLOT(disableHomeSettings(bool))); +} + + +void GeneralWidget::save() +{ +} + + +bool GeneralWidget::changed() +{ + return _changed; +} + + +void GeneralWidget::hasChanged() +{ +} + + +void GeneralWidget::setHomeToCurrentPage() +{ + MainWindow *mw = Application::instance()->mainWindow(); + WebTab *webTab = mw->currentTab(); + if (webTab) + { + kcfg_homePage->setText(webTab->url().prettyUrl()); + } +} + + +void GeneralWidget::disableHomeSettings(bool b) +{ + kcfg_homePage->setEnabled(!b); + setHomeToCurrentPageButton->setEnabled(!b); +} diff --git a/src/settings/generalwidget.h b/src/settings/generalwidget.h new file mode 100644 index 00000000..d669fd04 --- /dev/null +++ b/src/settings/generalwidget.h @@ -0,0 +1,60 @@ +/* ============================================================ +* +* This file is a part of the rekonq project +* +* Copyright (C) 2010 by Andrea Diamantini <adjam7 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 GENERAL_WIDGET_H +#define GENERAL_WIDGET_H + + +// Ui Includes +#include "ui_settings_general.h" + +// Qt Includes +#include <QtGui/QWidget> + + +class GeneralWidget : public QWidget, private Ui::general +{ + Q_OBJECT + +public: + GeneralWidget(QWidget *parent = 0); + + void save(); + bool changed(); + +signals: + void changed(bool); + +private slots: + void hasChanged(); + void setHomeToCurrentPage(); + void disableHomeSettings(bool); + +private: + bool _changed; +}; + +#endif // GENERAL_WIDGET_H diff --git a/src/settings/settings_adblock.ui b/src/settings/settings_adblock.ui index 699aef4d..8933fe60 100644 --- a/src/settings/settings_adblock.ui +++ b/src/settings/settings_adblock.ui @@ -17,14 +17,14 @@ <item> <widget class="QCheckBox" name="checkEnableAdblock"> <property name="text"> - <string>&Enable AdBlock</string> + <string>&Enable Ad Block</string> </property> </widget> </item> <item> <widget class="QCheckBox" name="checkHideAds"> <property name="text"> - <string>&Hide filtered Elements</string> + <string>&Hide filtered elements</string> </property> </widget> </item> @@ -128,6 +128,9 @@ </item> <item> <widget class="QToolButton" name="insertButton"> + <property name="toolTip"> + <string>Add filter expression</string> + </property> <property name="text"> <string>...</string> </property> @@ -135,6 +138,9 @@ </item> <item> <widget class="QToolButton" name="removeButton"> + <property name="toolTip"> + <string>Remove filter expression</string> + </property> <property name="text"> <string>...</string> </property> diff --git a/src/settings/settings_appearance.ui b/src/settings/settings_appearance.ui new file mode 100644 index 00000000..7ec23484 --- /dev/null +++ b/src/settings/settings_appearance.ui @@ -0,0 +1,286 @@ +<?xml version="1.0" encoding="UTF-8"?> +<ui version="4.0"> + <class>appearance</class> + <widget class="QWidget" name="appearance"> + <property name="geometry"> + <rect> + <x>0</x> + <y>0</y> + <width>351</width> + <height>455</height> + </rect> + </property> + <property name="windowTitle"> + <string>Appearance</string> + </property> + <layout class="QVBoxLayout" name="verticalLayout_3"> + <item> + <widget class="QGroupBox" name="groupBox"> + <property name="title"> + <string>Fonts</string> + </property> + <layout class="QVBoxLayout" name="verticalLayout_2"> + <item> + <layout class="QGridLayout" name="gridLayout"> + <item row="0" column="0"> + <widget class="QLabel" name="label"> + <property name="sizePolicy"> + <sizepolicy hsizetype="Maximum" vsizetype="Preferred"> + <horstretch>0</horstretch> + <verstretch>0</verstretch> + </sizepolicy> + </property> + <property name="minimumSize"> + <size> + <width>150</width> + <height>0</height> + </size> + </property> + <property name="text"> + <string>Standard font:</string> + </property> + <property name="alignment"> + <set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set> + </property> + </widget> + </item> + <item row="0" column="1"> + <widget class="KFontComboBox" name="standardFontChooser"/> + </item> + <item row="1" column="0"> + <widget class="QLabel" name="label_2"> + <property name="sizePolicy"> + <sizepolicy hsizetype="Maximum" vsizetype="Preferred"> + <horstretch>0</horstretch> + <verstretch>0</verstretch> + </sizepolicy> + </property> + <property name="minimumSize"> + <size> + <width>150</width> + <height>0</height> + </size> + </property> + <property name="text"> + <string>Fixed font:</string> + </property> + <property name="alignment"> + <set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set> + </property> + </widget> + </item> + <item row="1" column="1"> + <widget class="KFontComboBox" name="fixedFontChooser"/> + </item> + <item row="2" column="0"> + <widget class="QLabel" name="label_3"> + <property name="text"> + <string>Serif font:</string> + </property> + <property name="alignment"> + <set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set> + </property> + </widget> + </item> + <item row="2" column="1"> + <widget class="KFontComboBox" name="serifFontChooser"/> + </item> + <item row="3" column="0"> + <widget class="QLabel" name="label_6"> + <property name="text"> + <string>Sans Serif font:</string> + </property> + <property name="alignment"> + <set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set> + </property> + </widget> + </item> + <item row="3" column="1"> + <widget class="KFontComboBox" name="sansSerifFontChooser"/> + </item> + <item row="4" column="0"> + <widget class="QLabel" name="label_7"> + <property name="text"> + <string>Cursive font:</string> + </property> + <property name="alignment"> + <set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set> + </property> + </widget> + </item> + <item row="4" column="1"> + <widget class="KFontComboBox" name="cursiveFontChooser"/> + </item> + <item row="5" column="0"> + <widget class="QLabel" name="label_8"> + <property name="text"> + <string>Fantasy font:</string> + </property> + <property name="alignment"> + <set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set> + </property> + </widget> + </item> + <item row="5" column="1"> + <widget class="KFontComboBox" name="fantasyFontChooser"/> + </item> + </layout> + </item> + <item> + <widget class="Line" name="line"> + <property name="orientation"> + <enum>Qt::Horizontal</enum> + </property> + </widget> + </item> + <item> + <layout class="QGridLayout" name="gridLayout_2"> + <item row="0" column="0"> + <widget class="QLabel" name="label_9"> + <property name="sizePolicy"> + <sizepolicy hsizetype="Preferred" vsizetype="Preferred"> + <horstretch>0</horstretch> + <verstretch>0</verstretch> + </sizepolicy> + </property> + <property name="minimumSize"> + <size> + <width>150</width> + <height>0</height> + </size> + </property> + <property name="text"> + <string>Default font size:</string> + </property> + <property name="alignment"> + <set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set> + </property> + </widget> + </item> + <item row="0" column="1"> + <widget class="KIntNumInput" name="kcfg_defaultFontSize"/> + </item> + <item row="1" column="0"> + <widget class="QLabel" name="label_4"> + <property name="sizePolicy"> + <sizepolicy hsizetype="Preferred" vsizetype="Preferred"> + <horstretch>0</horstretch> + <verstretch>0</verstretch> + </sizepolicy> + </property> + <property name="minimumSize"> + <size> + <width>150</width> + <height>0</height> + </size> + </property> + <property name="text"> + <string>Minimal font size:</string> + </property> + <property name="alignment"> + <set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set> + </property> + </widget> + </item> + <item row="1" column="1"> + <widget class="KIntNumInput" name="kcfg_minFontSize"/> + </item> + </layout> + </item> + </layout> + </widget> + </item> + <item> + <widget class="QGroupBox" name="groupBox_3"> + <property name="title"> + <string>User Style Sheet</string> + </property> + <layout class="QFormLayout" name="formLayout_3"> + <item row="0" column="0"> + <widget class="QLabel" name="label_5"> + <property name="minimumSize"> + <size> + <width>150</width> + <height>0</height> + </size> + </property> + <property name="text"> + <string>User CSS path:</string> + </property> + <property name="alignment"> + <set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set> + </property> + </widget> + </item> + <item row="0" column="1"> + <widget class="KUrlRequester" name="kcfg_userCSS"> + <property name="filter"> + <string>*.css</string> + </property> + </widget> + </item> + </layout> + </widget> + </item> + <item> + <widget class="QGroupBox" name="groupBox_5"> + <property name="title"> + <string>Misc</string> + </property> + <layout class="QVBoxLayout" name="verticalLayout"> + <item> + <widget class="QCheckBox" name="kcfg_autoScroll"> + <property name="toolTip"> + <string>Toggle automatic scrolling on middle click in a web page</string> + </property> + <property name="text"> + <string>Auto-scroll on middle-click</string> + </property> + <property name="checked"> + <bool>true</bool> + </property> + </widget> + </item> + </layout> + </widget> + </item> + <item> + <spacer name="verticalSpacer"> + <property name="orientation"> + <enum>Qt::Vertical</enum> + </property> + <property name="sizeHint" stdset="0"> + <size> + <width>20</width> + <height>40</height> + </size> + </property> + </spacer> + </item> + </layout> + </widget> + <customwidgets> + <customwidget> + <class>KUrlRequester</class> + <extends>QFrame</extends> + <header>kurlrequester.h</header> + </customwidget> + <customwidget> + <class>KFontComboBox</class> + <extends>KComboBox</extends> + <header>kfontcombobox.h</header> + </customwidget> + <customwidget> + <class>KComboBox</class> + <extends>QComboBox</extends> + <header>kcombobox.h</header> + </customwidget> + <customwidget> + <class>KIntNumInput</class> + <extends>QWidget</extends> + <header>knuminput.h</header> + </customwidget> + </customwidgets> + <resources/> + <connections/> +</ui> diff --git a/src/settings/settings_fonts.ui b/src/settings/settings_fonts.ui deleted file mode 100644 index 52c7872e..00000000 --- a/src/settings/settings_fonts.ui +++ /dev/null @@ -1,192 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> -<ui version="4.0"> - <class>fonts</class> - <widget class="QWidget" name="fonts"> - <property name="geometry"> - <rect> - <x>0</x> - <y>0</y> - <width>414</width> - <height>298</height> - </rect> - </property> - <property name="windowTitle"> - <string>Appearance</string> - </property> - <layout class="QVBoxLayout" name="verticalLayout_3"> - <item> - <widget class="QGroupBox" name="groupBox"> - <property name="title"> - <string>Fonts</string> - </property> - <layout class="QFormLayout" name="formLayout"> - <item row="0" column="0"> - <widget class="QLabel" name="label"> - <property name="sizePolicy"> - <sizepolicy hsizetype="Maximum" vsizetype="Preferred"> - <horstretch>0</horstretch> - <verstretch>0</verstretch> - </sizepolicy> - </property> - <property name="minimumSize"> - <size> - <width>150</width> - <height>0</height> - </size> - </property> - <property name="text"> - <string>Standard font:</string> - </property> - <property name="alignment"> - <set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set> - </property> - </widget> - </item> - <item row="0" column="1"> - <widget class="KFontComboBox" name="kcfg_standardFont"> - <property name="sizePolicy"> - <sizepolicy hsizetype="Expanding" vsizetype="Fixed"> - <horstretch>0</horstretch> - <verstretch>0</verstretch> - </sizepolicy> - </property> - </widget> - </item> - <item row="1" column="0"> - <widget class="QLabel" name="label_2"> - <property name="sizePolicy"> - <sizepolicy hsizetype="Maximum" vsizetype="Preferred"> - <horstretch>0</horstretch> - <verstretch>0</verstretch> - </sizepolicy> - </property> - <property name="minimumSize"> - <size> - <width>150</width> - <height>0</height> - </size> - </property> - <property name="text"> - <string>Fixed font:</string> - </property> - <property name="alignment"> - <set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set> - </property> - </widget> - </item> - <item row="1" column="1"> - <widget class="KFontComboBox" name="kcfg_fixedFont"> - <property name="sizePolicy"> - <sizepolicy hsizetype="Expanding" vsizetype="Fixed"> - <horstretch>0</horstretch> - <verstretch>0</verstretch> - </sizepolicy> - </property> - </widget> - </item> - </layout> - </widget> - </item> - <item> - <widget class="QGroupBox" name="groupBox_2"> - <property name="title"> - <string>Dimension</string> - </property> - <layout class="QFormLayout" name="formLayout_2"> - <item row="0" column="0"> - <widget class="QLabel" name="label_3"> - <property name="sizePolicy"> - <sizepolicy hsizetype="Preferred" vsizetype="Preferred"> - <horstretch>0</horstretch> - <verstretch>0</verstretch> - </sizepolicy> - </property> - <property name="minimumSize"> - <size> - <width>150</width> - <height>0</height> - </size> - </property> - <property name="text"> - <string>Font size:</string> - </property> - <property name="alignment"> - <set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set> - </property> - </widget> - </item> - <item row="0" column="1"> - <widget class="QSpinBox" name="kcfg_fontSize"> - <property name="sizePolicy"> - <sizepolicy hsizetype="Expanding" vsizetype="Fixed"> - <horstretch>0</horstretch> - <verstretch>0</verstretch> - </sizepolicy> - </property> - </widget> - </item> - <item row="1" column="0"> - <widget class="QLabel" name="label_4"> - <property name="sizePolicy"> - <sizepolicy hsizetype="Preferred" vsizetype="Preferred"> - <horstretch>0</horstretch> - <verstretch>0</verstretch> - </sizepolicy> - </property> - <property name="minimumSize"> - <size> - <width>150</width> - <height>0</height> - </size> - </property> - <property name="text"> - <string>Minimal font size:</string> - </property> - <property name="alignment"> - <set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set> - </property> - </widget> - </item> - <item row="1" column="1"> - <widget class="QSpinBox" name="kcfg_minFontSize"> - <property name="sizePolicy"> - <sizepolicy hsizetype="Expanding" vsizetype="Fixed"> - <horstretch>0</horstretch> - <verstretch>0</verstretch> - </sizepolicy> - </property> - </widget> - </item> - </layout> - </widget> - </item> - <item> - <spacer name="verticalSpacer"> - <property name="orientation"> - <enum>Qt::Vertical</enum> - </property> - <property name="sizeHint" stdset="0"> - <size> - <width>20</width> - <height>40</height> - </size> - </property> - </spacer> - </item> - </layout> - </widget> - <customwidgets> - <customwidget> - <class>KFontComboBox</class> - <extends>KComboBox</extends> - <header>kfontcombobox.h</header> - </customwidget> - <customwidget> - <class>KComboBox</class> - <extends>QComboBox</extends> - <header>kcombobox.h</header> - </customwidget> - </customwidgets> - <resources/> - <connections/> -</ui> diff --git a/src/settings/settings_general.ui b/src/settings/settings_general.ui index c0060d76..92e409a2 100644 --- a/src/settings/settings_general.ui +++ b/src/settings/settings_general.ui @@ -6,8 +6,8 @@ <rect> <x>0</x> <y>0</y> - <width>552</width> - <height>512</height> + <width>464</width> + <height>462</height> </rect> </property> <property name="windowTitle"> @@ -141,7 +141,7 @@ <item row="0" column="1"> <widget class="QCheckBox" name="kcfg_useNewTabPage"> <property name="text"> - <string>Use New Tab Page</string> + <string>Use the New Tab Page as home page</string> </property> </widget> </item> @@ -244,25 +244,6 @@ </widget> </item> <item> - <widget class="QGroupBox" name="groupBox_5"> - <property name="title"> - <string>Navigation</string> - </property> - <layout class="QVBoxLayout" name="verticalLayout"> - <item> - <widget class="QCheckBox" name="kcfg_disableAutoScroll"> - <property name="toolTip"> - <string>Disable automatic scrolling on middle click in a web page</string> - </property> - <property name="text"> - <string>Disable auto scrolling</string> - </property> - </widget> - </item> - </layout> - </widget> - </item> - <item> <spacer name="verticalSpacer"> <property name="orientation"> <enum>Qt::Vertical</enum> diff --git a/src/settings/settings_tabs.ui b/src/settings/settings_tabs.ui index 8bc3ae70..138b5b5c 100644 --- a/src/settings/settings_tabs.ui +++ b/src/settings/settings_tabs.ui @@ -73,7 +73,7 @@ </size> </property> <property name="text"> - <string>New tab page starts with:</string> + <string>New Tab Page starts with:</string> </property> <property name="alignment"> <set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set> diff --git a/src/settings/settings_webkit.ui b/src/settings/settings_webkit.ui index e87e3fec..58fbe459 100644 --- a/src/settings/settings_webkit.ui +++ b/src/settings/settings_webkit.ui @@ -6,8 +6,8 @@ <rect> <x>0</x> <y>0</y> - <width>643</width> - <height>560</height> + <width>480</width> + <height>377</height> </rect> </property> <layout class="QVBoxLayout" name="verticalLayout"> @@ -192,38 +192,6 @@ </widget> </item> <item> - <widget class="QGroupBox" name="groupBox_2"> - <property name="title"> - <string>User Style Sheet</string> - </property> - <layout class="QFormLayout" name="formLayout_2"> - <item row="0" column="0"> - <widget class="QLabel" name="label"> - <property name="minimumSize"> - <size> - <width>150</width> - <height>0</height> - </size> - </property> - <property name="text"> - <string>User CSS path:</string> - </property> - <property name="alignment"> - <set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set> - </property> - </widget> - </item> - <item row="0" column="1"> - <widget class="KUrlRequester" name="kcfg_userCSS"> - <property name="filter"> - <string>*.css</string> - </property> - </widget> - </item> - </layout> - </widget> - </item> - <item> <spacer name="verticalSpacer"> <property name="orientation"> <enum>Qt::Vertical</enum> @@ -240,11 +208,6 @@ </widget> <customwidgets> <customwidget> - <class>KUrlRequester</class> - <extends>QFrame</extends> - <header>kurlrequester.h</header> - </customwidget> - <customwidget> <class>KComboBox</class> <extends>QComboBox</extends> <header>kcombobox.h</header> diff --git a/src/settings/settingsdialog.cpp b/src/settings/settingsdialog.cpp index 3f701c5b..27d40467 100644 --- a/src/settings/settingsdialog.cpp +++ b/src/settings/settingsdialog.cpp @@ -36,15 +36,15 @@ #include "application.h" #include "mainwindow.h" #include "webtab.h" -#include "adblockwidget.h" -#include "networkwidget.h" #include "searchengine.h" -//Ui Includes -#include "ui_settings_general.h" -#include "ui_settings_tabs.h" -#include "ui_settings_fonts.h" -#include "ui_settings_webkit.h" +// Widget Includes +#include "adblockwidget.h" +#include "networkwidget.h" +#include "generalwidget.h" +#include "appearancewidget.h" +#include "webkitwidget.h" +#include "tabswidget.h" // KDE Includes #include <KConfig> @@ -61,76 +61,79 @@ class Private { private: + Private(SettingsDialog *parent); - Ui::general generalUi; - Ui::tabs tabsUi; - Ui::fonts fontsUi; - Ui::webkit webkitUi; - - AdBlockWidget *adBlockWidg; +private: + GeneralWidget *generalWidg; + TabsWidget *tabsWidg; + AppearanceWidget *appearanceWidg; + WebKitWidget *webkitWidg; NetworkWidget *networkWidg; - + AdBlockWidget *adBlockWidg; + KCModuleProxy *ebrowsingModule; KShortcutsEditor *shortcutsEditor; - Private(SettingsDialog *parent); - friend class SettingsDialog; }; Private::Private(SettingsDialog *parent) { - QWidget *widget; KPageWidgetItem *pageItem; - widget = new QWidget; - generalUi.setupUi(widget); - widget->layout()->setMargin(0); - pageItem = parent->addPage(widget , i18n("General")); + // -- 1 + generalWidg = new GeneralWidget(parent); + generalWidg->layout()->setMargin(0); + pageItem = parent->addPage(generalWidg, i18n("General")); pageItem->setIcon(KIcon("rekonq")); - widget = new QWidget; - tabsUi.setupUi(widget); - widget->layout()->setMargin(0); - pageItem = parent->addPage(widget , i18n("Tabs")); + // -- 2 + tabsWidg = new TabsWidget(parent); + tabsWidg->layout()->setMargin(0); + pageItem = parent->addPage(tabsWidg, i18n("Tabs")); pageItem->setIcon(KIcon("tab-duplicate")); - - widget = new QWidget; - fontsUi.setupUi(widget); - widget->layout()->setMargin(0); - pageItem = parent->addPage(widget , i18n("Fonts")); + + // -- 3 + appearanceWidg = new AppearanceWidget(parent); + appearanceWidg->layout()->setMargin(0); + pageItem = parent->addPage(appearanceWidg, i18n("Appearance")); pageItem->setIcon(KIcon("preferences-desktop-font")); - - widget = new QWidget; - webkitUi.setupUi(widget); - widget->layout()->setMargin(0); - pageItem = parent->addPage(widget , i18n("WebKit")); + + // -- 4 + webkitWidg = new WebKitWidget(parent); + webkitWidg->layout()->setMargin(0); + pageItem = parent->addPage(webkitWidg, i18n("WebKit")); QString webkitIconPath = KStandardDirs::locate("appdata", "pics/webkit-icon.png"); KIcon webkitIcon = KIcon(QIcon(webkitIconPath)); pageItem->setIcon(webkitIcon); - + + // -- 5 networkWidg = new NetworkWidget(parent); networkWidg->layout()->setMargin(0); pageItem = parent->addPage(networkWidg , i18n("Network")); pageItem->setIcon(KIcon("preferences-system-network")); + // -- 6 adBlockWidg = new AdBlockWidget(parent); adBlockWidg->layout()->setMargin(0); pageItem = parent->addPage(adBlockWidg , i18n("Ad Block")); pageItem->setIcon(KIcon("preferences-web-browser-adblock")); + // -- 7 shortcutsEditor = new KShortcutsEditor(Application::instance()->mainWindow()->actionCollection(), parent); pageItem = parent->addPage(shortcutsEditor , i18n("Shortcuts")); pageItem->setIcon(KIcon("configure-shortcuts")); + // -- 8 KCModuleInfo ebrowsingInfo("ebrowsing.desktop"); ebrowsingModule = new KCModuleProxy(ebrowsingInfo, parent); pageItem = parent->addPage(ebrowsingModule, i18n(ebrowsingInfo.moduleName().toLocal8Bit())); pageItem->setIcon(KIcon(ebrowsingInfo.icon())); - // WARNING remember wheh changing here that the smallest netbooks + // WARNING + // remember wheh changing here that the smallest netbooks // have a 1024x576 resolution. So DON'T bother that limits!! parent->setMinimumSize(700, 525); } @@ -148,25 +151,20 @@ SettingsDialog::SettingsDialog(QWidget *parent) setModal(true); readConfig(); - - connect(d->generalUi.setHomeToCurrentPageButton, SIGNAL(clicked()), this, SLOT(setHomeToCurrentPage())); - - // new tab page - disableHomeSettings(ReKonfig::useNewTabPage()); - connect(d->generalUi.kcfg_useNewTabPage, SIGNAL(toggled(bool)), this, SLOT(disableHomeSettings(bool))); // update buttons - connect(d->adBlockWidg, SIGNAL(changed(bool)), this, SLOT(updateButtons())); + connect(d->generalWidg, SIGNAL(changed(bool)), this, SLOT(updateButtons())); + connect(d->tabsWidg, SIGNAL(changed(bool)), this, SLOT(updateButtons())); + connect(d->appearanceWidg, SIGNAL(changed(bool)), this, SLOT(updateButtons())); + connect(d->webkitWidg, SIGNAL(changed(bool)), this, SLOT(updateButtons())); connect(d->networkWidg, SIGNAL(changed(bool)), this, SLOT(updateButtons())); + connect(d->adBlockWidg, SIGNAL(changed(bool)), this, SLOT(updateButtons())); connect(d->ebrowsingModule, SIGNAL(changed(bool)), this, SLOT(updateButtons())); - connect(d->shortcutsEditor, SIGNAL(keyChange()), this, SLOT(updateButtons())); // save settings connect(this, SIGNAL(applyClicked()), this, SLOT(saveSettings())); connect(this, SIGNAL(okClicked()), this, SLOT(saveSettings())); - - setWebSettingsToolTips(); } @@ -176,29 +174,9 @@ SettingsDialog::~SettingsDialog() } -void SettingsDialog::setWebSettingsToolTips() -{ - d->webkitUi.kcfg_autoLoadImages->setToolTip(i18n("Specifies whether images are automatically loaded in web pages.")); - d->webkitUi.kcfg_dnsPrefetch->setToolTip(i18n("Specifies whether WebKit will try to prefetch DNS entries to speed up browsing.")); - d->webkitUi.kcfg_javascriptEnabled->setToolTip(i18n("Enables the execution of JavaScript programs.")); - d->webkitUi.kcfg_javaEnabled->setToolTip(i18n("Enables support for Java applets.")); - d->webkitUi.kcfg_pluginsEnabled->setToolTip(i18n("Enables support for plugins in web pages.")); - d->webkitUi.kcfg_javascriptCanOpenWindows->setToolTip(i18n("If enabled, JavaScript programs are allowed to open new windows.")); - d->webkitUi.kcfg_javascriptCanAccessClipboard->setToolTip(i18n("If enabled, JavaScript programs are allowed to read from and to write to the clipboard.")); - d->webkitUi.kcfg_linksIncludedInFocusChain->setToolTip(i18n("If enabled, hyperlinks are included in the keyboard focus chain.")); - d->webkitUi.kcfg_zoomTextOnly->setToolTip(i18n("If enabled, the zoom factor on a frame is only applied to the text.")); - d->webkitUi.kcfg_printElementBackgrounds->setToolTip(i18n("If enabled, background colors and images are also drawn when the page is printed.")); - d->webkitUi.kcfg_offlineStorageDatabaseEnabled->setToolTip(i18n("Enables support for the HTML 5 offline storage feature.")); - d->webkitUi.kcfg_offlineWebApplicationCacheEnabled->setToolTip(i18n("Enables support for the HTML 5 web application cache feature.")); - d->webkitUi.kcfg_localStorageEnabled->setToolTip(i18n("Enables support for the HTML 5 local storage feature.")); -} - - // we need this function to UPDATE the config widget data.. void SettingsDialog::readConfig() { - // ======= Fonts - d->fontsUi.kcfg_fixedFont->setOnlyFixed(true); } @@ -209,15 +187,20 @@ void SettingsDialog::saveSettings() return; ReKonfig::self()->writeConfig(); - d->ebrowsingModule->save(); - d->shortcutsEditor->save(); - d->adBlockWidg->save(); + + d->generalWidg->save(); + d->tabsWidg->save(); + d->appearanceWidg->save(); + d->webkitWidg->save(); d->networkWidg->save(); + d->adBlockWidg->save(); + d->shortcutsEditor->save(); + d->ebrowsingModule->save(); + SearchEngine::loadDefaultWS(); SearchEngine::loadDelimiter(); SearchEngine::loadFavorites(); - updateButtons(); emit settingsChanged("ReKonfig"); } @@ -226,27 +209,13 @@ void SettingsDialog::saveSettings() bool SettingsDialog::hasChanged() { return KConfigDialog::hasChanged() - || d->adBlockWidg->changed() + || d->generalWidg->changed() + || d->tabsWidg->changed() + || d->appearanceWidg->changed() + || d->webkitWidg->changed() || d->networkWidg->changed() + || d->adBlockWidg->changed() || d->ebrowsingModule->changed() || d->shortcutsEditor->isModified(); ; } - - -void SettingsDialog::setHomeToCurrentPage() -{ - MainWindow *mw = static_cast<MainWindow*>(parent()); - WebTab *webTab = mw->currentTab(); - if (webTab) - { - d->generalUi.kcfg_homePage->setText(webTab->url().prettyUrl()); - } -} - - -void SettingsDialog::disableHomeSettings(bool b) -{ - d->generalUi.kcfg_homePage->setEnabled(!b); - d->generalUi.setHomeToCurrentPageButton->setEnabled(!b); -} diff --git a/src/settings/settingsdialog.h b/src/settings/settingsdialog.h index cade78e3..c25db74b 100644 --- a/src/settings/settingsdialog.h +++ b/src/settings/settingsdialog.h @@ -52,14 +52,10 @@ public: private: Private* const d; - void setWebSettingsToolTips(); private slots: void readConfig(); void saveSettings(); - - void setHomeToCurrentPage(); - void disableHomeSettings(bool); }; #endif // SETTINGS_DIALOG_H diff --git a/src/settings/tabswidget.cpp b/src/settings/tabswidget.cpp new file mode 100644 index 00000000..aa555339 --- /dev/null +++ b/src/settings/tabswidget.cpp @@ -0,0 +1,53 @@ +/* ============================================================ +* +* This file is a part of the rekonq project +* +* Copyright (C) 2010 by Andrea Diamantini <adjam7 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/>. +* +* ============================================================ */ + + +// Local Includes +#include "tabswidget.h" +#include "tabswidget.moc" + + +TabsWidget::TabsWidget(QWidget *parent) + : QWidget(parent) + , _changed(false) +{ + setupUi(this); +} + + +void TabsWidget::save() +{ +} + + +bool TabsWidget::changed() +{ + return _changed; +} + + +void TabsWidget::hasChanged() +{ +} diff --git a/src/settings/tabswidget.h b/src/settings/tabswidget.h new file mode 100644 index 00000000..f1ff8a52 --- /dev/null +++ b/src/settings/tabswidget.h @@ -0,0 +1,58 @@ +/* ============================================================ +* +* This file is a part of the rekonq project +* +* Copyright (C) 2010 by Andrea Diamantini <adjam7 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 TABS_WIDGET_H +#define TABS_WIDGET_H + + +// Ui Includes +#include "ui_settings_tabs.h" + +// Qt Includes +#include <QtGui/QWidget> + + +class TabsWidget : public QWidget, private Ui::tabs +{ + Q_OBJECT + +public: + TabsWidget(QWidget *parent = 0); + + void save(); + bool changed(); + +signals: + void changed(bool); + +private slots: + void hasChanged(); + +private: + bool _changed; +}; + +#endif // TABS_WIDGET_H diff --git a/src/settings/webkitwidget.cpp b/src/settings/webkitwidget.cpp new file mode 100644 index 00000000..f9d94d76 --- /dev/null +++ b/src/settings/webkitwidget.cpp @@ -0,0 +1,71 @@ +/* ============================================================ +* +* This file is a part of the rekonq project +* +* Copyright (C) 2010 by Andrea Diamantini <adjam7 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/>. +* +* ============================================================ */ + + +// Local Includes +#include "webkitwidget.h" +#include "webkitwidget.moc" + + +WebKitWidget::WebKitWidget(QWidget *parent) + : QWidget(parent) + , _changed(false) +{ + setupUi(this); +} + + +void WebKitWidget::save() +{ +} + + +bool WebKitWidget::changed() +{ + return _changed; +} + + +void WebKitWidget::hasChanged() +{ +} + + +void WebKitWidget::setWebSettingsToolTips() +{ + kcfg_autoLoadImages->setToolTip(i18n("Specifies whether images are automatically loaded in web pages.")); + kcfg_dnsPrefetch->setToolTip(i18n("Specifies whether WebKit will try to prefetch DNS entries to speed up browsing.")); + kcfg_javascriptEnabled->setToolTip(i18n("Enables the execution of JavaScript programs.")); + kcfg_javaEnabled->setToolTip(i18n("Enables support for Java applets.")); + kcfg_pluginsEnabled->setToolTip(i18n("Enables support for plugins in web pages.")); + kcfg_javascriptCanOpenWindows->setToolTip(i18n("If enabled, JavaScript programs are allowed to open new windows.")); + kcfg_javascriptCanAccessClipboard->setToolTip(i18n("If enabled, JavaScript programs are allowed to read from and to write to the clipboard.")); + kcfg_linksIncludedInFocusChain->setToolTip(i18n("If enabled, hyperlinks are included in the keyboard focus chain.")); + kcfg_zoomTextOnly->setToolTip(i18n("If enabled, the zoom factor on a frame is only applied to the text.")); + kcfg_printElementBackgrounds->setToolTip(i18n("If enabled, background colors and images are also drawn when the page is printed.")); + kcfg_offlineStorageDatabaseEnabled->setToolTip(i18n("Enables support for the HTML 5 offline storage feature.")); + kcfg_offlineWebApplicationCacheEnabled->setToolTip(i18n("Enables support for the HTML 5 web application cache feature.")); + kcfg_localStorageEnabled->setToolTip(i18n("Enables support for the HTML 5 local storage feature.")); +} diff --git a/src/settings/webkitwidget.h b/src/settings/webkitwidget.h new file mode 100644 index 00000000..b1eb8d76 --- /dev/null +++ b/src/settings/webkitwidget.h @@ -0,0 +1,60 @@ +/* ============================================================ +* +* This file is a part of the rekonq project +* +* Copyright (C) 2010 by Andrea Diamantini <adjam7 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 WEBKIT_WIDGET_H +#define WEBKIT_WIDGET_H + + +// Ui Includes +#include "ui_settings_webkit.h" + +// Qt Includes +#include <QtGui/QWidget> + + +class WebKitWidget : public QWidget, private Ui::webkit +{ + Q_OBJECT + +public: + WebKitWidget(QWidget *parent = 0); + + void save(); + bool changed(); + +signals: + void changed(bool); + +private slots: + void hasChanged(); + +private: + void setWebSettingsToolTips(); + + bool _changed; +}; + +#endif // WEBKIT_WIDGET_H diff --git a/src/tabbar.cpp b/src/tabbar.cpp index 1274d813..5d6b7b2c 100644 --- a/src/tabbar.cpp +++ b/src/tabbar.cpp @@ -186,6 +186,11 @@ void TabBar::showTabPreview(int tab) void TabBar::mouseMoveEvent(QMouseEvent *event) { + if (count() == 1) + { + return; + } + if (event->buttons() & Qt::LeftButton) { // hide addNewTabButton when moving tabs diff --git a/src/urlbar/completionwidget.cpp b/src/urlbar/completionwidget.cpp index acec2d4f..a71e9611 100644 --- a/src/urlbar/completionwidget.cpp +++ b/src/urlbar/completionwidget.cpp @@ -79,7 +79,7 @@ void CompletionWidget::insertSearchList(const UrlSearchList &list, const QString { ListItem *suggestion = ListItemFactory::create(item, text, this); suggestion->setBackgroundRole(i % 2 ? QPalette::AlternateBase : QPalette::Base); - connect(suggestion, SIGNAL(itemClicked(ListItem *, Qt::MouseButton)), this, SLOT(itemChosen(ListItem *, Qt::MouseButton))); + connect(suggestion, SIGNAL(itemClicked(ListItem *, Qt::MouseButton, Qt::KeyboardModifiers)), this, SLOT(itemChosen(ListItem *, Qt::MouseButton, Qt::KeyboardModifiers))); connect(this, SIGNAL(nextItemSubChoice()), suggestion, SLOT(nextItemSubChoice())); suggestion->setObjectName(QString::number(i++)); layout()->addWidget(suggestion); @@ -270,9 +270,9 @@ void CompletionWidget::setVisible(bool visible) } -void CompletionWidget::itemChosen(ListItem *item, Qt::MouseButton button) +void CompletionWidget::itemChosen(ListItem *item, Qt::MouseButton button, Qt::KeyboardModifiers modifier) { - if (button == Qt::MidButton) + if (button == Qt::MidButton || modifier == Qt::ControlModifier) emit chosenUrl(item->url(), Rekonq::NewCurrentTab); else emit chosenUrl(item->url(), Rekonq::CurrentTab); diff --git a/src/urlbar/completionwidget.h b/src/urlbar/completionwidget.h index 90cd2b23..18212d0f 100644 --- a/src/urlbar/completionwidget.h +++ b/src/urlbar/completionwidget.h @@ -64,7 +64,7 @@ public: void suggestUrls(const QString &text); private slots: - void itemChosen(ListItem *item, Qt::MouseButton = Qt::LeftButton); + void itemChosen(ListItem *item, Qt::MouseButton = Qt::LeftButton, Qt::KeyboardModifiers = Qt::NoModifier); signals: void chosenUrl(const KUrl &, Rekonq::OpenType); diff --git a/src/urlbar/listitem.cpp b/src/urlbar/listitem.cpp index 13535a74..78a929a8 100644 --- a/src/urlbar/listitem.cpp +++ b/src/urlbar/listitem.cpp @@ -129,7 +129,7 @@ void ListItem::leaveEvent(QEvent *e) void ListItem::mousePressEvent(QMouseEvent *e) { - emit itemClicked(this, e->button()); + emit itemClicked(this, e->button(), e->modifiers()); QWidget::mousePressEvent(e); } @@ -220,7 +220,16 @@ PreviewListItem::PreviewListItem(const UrlSearchItem &item, const QString &text, QVBoxLayout *vLayout = new QVBoxLayout; vLayout->setMargin(0); - vLayout->addWidget(new TextLabel(item.title, text, this)); + + QString title = item.title; + if (title.isEmpty()) + { + title = item.url.url(); + title = title.remove("http://"); + title.truncate(title.indexOf("/")); + } + + vLayout->addWidget(new TextLabel(title, text, this)); vLayout->addWidget(new TextLabel("<i>" + item.url.url() + "</i>", text, this)); hLayout->addLayout(vLayout); diff --git a/src/urlbar/listitem.h b/src/urlbar/listitem.h index c26a1893..dcb4f76d 100644 --- a/src/urlbar/listitem.h +++ b/src/urlbar/listitem.h @@ -66,7 +66,7 @@ public slots: virtual void nextItemSubChoice(); signals: - void itemClicked(ListItem *item, Qt::MouseButton); + void itemClicked(ListItem *item, Qt::MouseButton, Qt::KeyboardModifiers); protected: virtual void paintEvent(QPaintEvent *event); diff --git a/src/urlbar/rsswidget.cpp b/src/urlbar/rsswidget.cpp index 35095c07..6cd63b95 100644 --- a/src/urlbar/rsswidget.cpp +++ b/src/urlbar/rsswidget.cpp @@ -115,9 +115,12 @@ RSSWidget::~RSSWidget() void RSSWidget::showAt(const QPoint &pos) { + adjustSize(); + QPoint p; - p.setX(pos.x() - 200); + p.setX(pos.x() - width()); p.setY(pos.y() + 10); + move(p); show(); } @@ -160,7 +163,7 @@ void RSSWidget::addWithAkregator(const QString &url) if (!reply.isValid()) { - KMessageBox::error(0, QString(i18n("Could not add stream to akregator, Please add it manually :") + KMessageBox::error(0, QString(i18n("Could not add feed to Akregator. Please add it manually:") + "<br /><br /> <a href=\"" + url + "\">" + url + "</a>")); } } diff --git a/src/urlbar/urlbar.cpp b/src/urlbar/urlbar.cpp index 6ec461a2..b46eccdb 100644 --- a/src/urlbar/urlbar.cpp +++ b/src/urlbar/urlbar.cpp @@ -91,7 +91,7 @@ UrlBar::UrlBar(QWidget *parent) setUrlDropsEnabled(true); // tooltip - setToolTip(i18n("Type here to search your bookmarks, history and the web..")); + setToolTip(i18n("Type here to search your bookmarks, history and the web...")); // accept focus, via tabbing, clicking & wheeling setFocusPolicy(Qt::WheelFocus); @@ -101,6 +101,8 @@ UrlBar::UrlBar(QWidget *parent) _tab = qobject_cast<WebTab *>(parent); + connect(_tab, SIGNAL(loadProgressing()), this, SLOT(update())); + connect(_tab->view(), SIGNAL(urlChanged(const QUrl &)), this, SLOT(setQUrl(const QUrl &))); connect(_tab->view(), SIGNAL(loadFinished(bool)), this, SLOT(loadFinished())); connect(_tab->view(), SIGNAL(loadStarted()), this, SLOT(clearRightIcons())); @@ -152,7 +154,7 @@ void UrlBar::activated(const KUrl& url, Rekonq::OpenType type) void UrlBar::paintEvent(QPaintEvent *event) -{ +{ QColor backgroundColor; if (_privateMode) { @@ -177,10 +179,13 @@ void UrlBar::paintEvent(QPaintEvent *event) } else { - QColor loadingColor = QColor(116, 192, 250); + // NOTE: I chose this instead of the old QColor(116, 192, 250) + // to try respecting style colors + QColor loadingColor = Application::palette().color(QPalette::ToolTipBase); - QLinearGradient gradient(0, 0, width(), 0); + QLinearGradient gradient( QPoint(0, 0), QPoint(width(), height()) ); gradient.setColorAt(0, loadingColor); + gradient.setColorAt(((double)progr) / 100 - .000001, loadingColor); gradient.setColorAt(((double)progr) / 100, backgroundColor); p.setBrush(QPalette::Base, gradient); } @@ -198,7 +203,7 @@ void UrlBar::paintEvent(QPaintEvent *event) painter.setPen(Qt::gray); painter.drawText(textRect, Qt::AlignVCenter | Qt::AlignCenter, - i18n("Type here to search your bookmarks, history and the web..") + i18n("Type here to search your bookmarks, history and the web...") ); } } diff --git a/src/urlbar/urlresolver.cpp b/src/urlbar/urlresolver.cpp index 21e3fe9c..7333e305 100644 --- a/src/urlbar/urlresolver.cpp +++ b/src/urlbar/urlresolver.cpp @@ -74,7 +74,7 @@ UrlResolver::UrlResolver(const QString &typedUrl) { kDebug() << "browse regexp empty. Setting value.."; - QString protocol = "^(http://|https://|file://|ftp://)"; + QString protocol = "^(http://|https://|file://|ftp://|man:|info:)"; QString local = "^/"; @@ -91,7 +91,7 @@ UrlResolver::UrlResolver(const QString &typedUrl) "y[etu]|z[amw]|aero|arpa|biz|com|coop|edu|info|int|gov|mil|museum|name|net|org|"\ "pro)"; - _browseRegexp = QRegExp("(" + protocol + ")|(" + local + ")|(" + address + ")|(" + ipv6 + ")|(" + ipv4 +")"); + _browseRegexp = QRegExp('(' + protocol + ")|(" + local + ")|(" + address + ")|(" + ipv6 + ")|(" + ipv4 +')'); } } @@ -141,12 +141,23 @@ UrlSearchList UrlResolver::orderedSearchItems() int checkPoint = 9 - firstResults; UrlSearchList historyList = historyResolution(); + UrlSearchItem privileged = privilegedItem(&historyList); int historyResults = historyList.count(); + + UrlSearchList bookmarksList = bookmarksResolution(); + if (privileged.type == UrlSearchItem::Undefined) + { + privileged = privilegedItem(&bookmarksList); + } + + if (privileged.type != UrlSearchItem::Undefined) + { + list.insert(0,privileged); + } - UrlSearchList bookmarksList = bookmarksResolution(); - int bookmarkResults = bookmarksList.count(); + int bookmarksResults = bookmarksList.count(); - if (historyResults + bookmarkResults > checkPoint) + if (historyResults + bookmarksResults > checkPoint) { historyList = historyList.mid(0, 3); bookmarksList = bookmarksList.mid(0, 3); @@ -178,8 +189,6 @@ UrlSearchList UrlResolver::orderedSearchItems() list << i; } - list = placeTypedDomaineNameOnTop(list); - return list; } @@ -246,22 +255,19 @@ UrlSearchList UrlResolver::bookmarksResolution() } -UrlSearchList UrlResolver::placeTypedDomaineNameOnTop(UrlSearchList list) +UrlSearchItem UrlResolver::privilegedItem(UrlSearchList* list) { - int i = 0; - bool found = false; - - while(i<list.count() && !found) + int i=0; + while(i<list->count()) { - UrlSearchItem item = list.at(i); - if (item.url.url().contains("."+_typedString+".") || item.url.url().contains("/"+_typedString+".")) + UrlSearchItem item = list->at(i); + kDebug() << item.url.host(); + if (item.url.host().contains( _typedString + QL1C('.') ) ) { - list.removeAt(i); - list.insert(0,item); - found = true; + list->removeAt(i); + return item; } i++; } - - return list; + return UrlSearchItem(); } diff --git a/src/urlbar/urlresolver.h b/src/urlbar/urlresolver.h index 0c7df8c8..2249ea32 100644 --- a/src/urlbar/urlresolver.h +++ b/src/urlbar/urlresolver.h @@ -45,6 +45,7 @@ public: enum types { + Undefined = 0x00000000, Search = 0x00000001, Browse = 0x00000010, History = 0x00000100, @@ -54,7 +55,15 @@ public: int type; KUrl url; QString title; - + + UrlSearchItem(const UrlSearchItem &item) + : type(item.type), url(item.url), title(item.title) + {}; + + UrlSearchItem() + : type(UrlSearchItem::Undefined), url(KUrl()), title("") + {}; + UrlSearchItem(const int &_type, const KUrl &_url, const QString &_title = QString()) : type(_type), url(_url), title(_title) {}; @@ -82,7 +91,7 @@ private: UrlSearchList historyResolution(); UrlSearchList qurlFromUserInputResolution(); UrlSearchList bookmarksResolution(); - UrlSearchList placeTypedDomaineNameOnTop(UrlSearchList list); + UrlSearchItem privilegedItem(UrlSearchList* list); static QRegExp _browseRegexp; }; diff --git a/src/webpage.cpp b/src/webpage.cpp index 9da75a91..4a8c8b6b 100644 --- a/src/webpage.cpp +++ b/src/webpage.cpp @@ -97,6 +97,75 @@ static bool domainSchemeMatch(const QUrl& u1, const QUrl& u2) } +// NOTE +// This is heavily based on the one from KdeWebKit and +// extended to provide the extra functionality we need: +// 1. KGet Integration +// 2. Save downloads history +static bool downloadResource (const KUrl& srcUrl, const KIO::MetaData& metaData = KIO::MetaData(), + QWidget* parent = 0, const QString& suggestedName = QString()) +{ + KUrl destUrl; + + int result = KIO::R_OVERWRITE; + const QUrl fileName ((suggestedName.isEmpty() ? srcUrl.fileName() : suggestedName)); + + do + { + destUrl = KFileDialog::getSaveFileName(fileName, QString(), parent); + + if(destUrl.isEmpty()) + return false; + + if (destUrl.isLocalFile()) + { + QFileInfo finfo (destUrl.toLocalFile()); + if (finfo.exists()) + { + QDateTime now = QDateTime::currentDateTime(); + KIO::RenameDialog dlg (parent, i18n("Overwrite File?"), srcUrl, destUrl, + KIO::RenameDialog_Mode(KIO::M_OVERWRITE | KIO::M_SKIP), + -1, finfo.size(), + now.toTime_t(), finfo.created().toTime_t(), + now.toTime_t(), finfo.lastModified().toTime_t()); + result = dlg.exec(); + } + } + } + while (result == KIO::R_CANCEL && destUrl.isValid()); + + // Save download on history manager + Application::historyManager()->addDownload(srcUrl.pathOrUrl() , destUrl.pathOrUrl()); + + if (ReKonfig::kgetDownload()) + { + //KGet integration: + if (!QDBusConnection::sessionBus().interface()->isServiceRegistered("org.kde.kget")) + { + KToolInvocation::kdeinitExecWait("kget"); + } + QDBusInterface kget("org.kde.kget", "/KGet", "org.kde.kget.main"); + if (kget.isValid()) + { + kget.call("addTransfer", srcUrl.prettyUrl(), destUrl.prettyUrl(), true); + return true; + } + return false; + } + + KIO::Job *job = KIO::file_copy(srcUrl, destUrl, -1, KIO::Overwrite); + + if (!metaData.isEmpty()) + job->setMetaData(metaData); + + job->addMetaData(QL1S("MaxCacheSize"), QL1S("0")); // Don't store in http cache. + job->addMetaData(QL1S("cache"), QL1S("cache")); // Use entry from cache if available. + job->uiDelegate()->setAutoErrorHandlingEnabled(true); + return true; + +} + + // --------------------------------------------------------------------------------- @@ -148,8 +217,6 @@ WebPage::~WebPage() bool WebPage::acceptNavigationRequest(QWebFrame *frame, const QNetworkRequest &request, NavigationType type) { _isOnRekonqPage = false; - kDebug() << "ACCEPT_NAVIGATION false"; - _loadingUrl = request.url(); KIO::AccessManager *manager = qobject_cast<KIO::AccessManager*>(networkAccessManager()); @@ -218,8 +285,6 @@ bool WebPage::acceptNavigationRequest(QWebFrame *frame, const QNetworkRequest &r WebPage *WebPage::createWindow(QWebPage::WebWindowType type) { - kDebug() << "WebPage createWindow slot"; - // added to manage web modal dialogs if (type == QWebPage::WebModalDialog) kDebug() << "Modal Dialog"; @@ -250,115 +315,151 @@ void WebPage::handleUnsupportedContent(QNetworkReply *reply) if (_protHandler.postHandling(reply->request(), mainFrame())) return; - if (reply->error() == QNetworkReply::NoError) - { - KUrl replyUrl = reply->url(); + if (reply->error() != QNetworkReply::NoError) + return; + + KUrl replyUrl = reply->url(); - // HACK ------------------------------------------- - QString mimeType; - QString suggestedFileName; - - QString app = reply->header(QNetworkRequest::ContentTypeHeader).toString(); - QStringList headerList = app.split( ';' ); - - kDebug() << headerList; - kDebug() << headerList.count(); - - if(headerList.count() > 0) + // HACK ------------------------------------------- + // This is done to fix #231204 && #212808 + + QString mimeType; + QString suggestedFileName; + + QString app = reply->header(QNetworkRequest::ContentTypeHeader).toString(); + QStringList headerList = app.split( ';' ); + + if(headerList.count() > 0) + { + mimeType = headerList.takeFirst().trimmed(); + Q_FOREACH(const QString &head, headerList) { - mimeType = headerList.takeFirst().trimmed(); - Q_FOREACH(const QString &head, headerList) + if( head.contains( QL1S("name") ) ) { - if( head.contains( QL1S("name") ) ) - { - // this is not so sure.. :) - suggestedFileName = head; - suggestedFileName = suggestedFileName.remove( QL1S("name=") ); - suggestedFileName = suggestedFileName.remove( '"' ); - suggestedFileName = suggestedFileName.trimmed(); - break; - } + // this is not so sure.. :) + suggestedFileName = head; + suggestedFileName = suggestedFileName.remove( QL1S("name=") ); + suggestedFileName = suggestedFileName.remove( '"' ); + suggestedFileName = suggestedFileName.trimmed(); + break; } } - else + } + else + { + mimeType = reply->header(QNetworkRequest::ContentTypeHeader).toString(); + } + + // NOTE + // This part has been copied from KWebPage::downloadResponse code + if (reply->hasRawHeader("Content-Disposition")) + { + KIO::MetaData metaData = reply->attribute(static_cast<QNetworkRequest::Attribute>(KIO::AccessManager::MetaData)).toMap(); + if (metaData.value(QL1S("content-disposition-type")).compare(QL1S("attachment"), Qt::CaseInsensitive) == 0) { - mimeType = reply->header(QNetworkRequest::ContentTypeHeader).toString(); + suggestedFileName = metaData.value(QL1S("content-disposition-filename")); + } + else + { + const QString value = QL1S(reply->rawHeader("Content-Disposition").simplified()); + if (value.startsWith(QL1S("attachment"), Qt::CaseInsensitive)) + { + const int length = value.size(); + int pos = value.indexOf(QL1S("filename"), 0, Qt::CaseInsensitive); + if (pos > -1) + { + pos += 9; + while (pos < length && (value.at(pos) == QL1C(' ') || value.at(pos) == QL1C('=') || value.at(pos) == QL1C('"'))) + pos++; + + int endPos = pos; + while (endPos < length && value.at(endPos) != QL1C('"') && value.at(endPos) != QL1C(';')) + endPos++; + + if (endPos > pos) + { + suggestedFileName = value.mid(pos, (endPos-pos)).trimmed(); + } + } + } } - // ------------------------------------------------ - - KService::Ptr appService = KMimeTypeTrader::self()->preferredService(mimeType); + } + + kDebug() << "Detected MimeType = " << mimeType; + kDebug() << "Suggested File Name = " << suggestedFileName; + // ------------------------------------------------ + + KService::Ptr appService = KMimeTypeTrader::self()->preferredService(mimeType); - bool isLocal = replyUrl.isLocalFile(); + bool isLocal = replyUrl.isLocalFile(); - if (appService.isNull()) // no service can handle this. We can just download it.. - { - kDebug() << "no service can handle this. We can just download it.."; + if (appService.isNull()) // no service can handle this. We can just download it.. + { + kDebug() << "no service can handle this. We can just download it.."; - isLocal - ? KMessageBox::sorry(view(), i18n("No service can handle this :(")) - : downloadThings(reply->request(), suggestedFileName); + isLocal + ? KMessageBox::sorry(view(), i18n("No service can handle this :(")) + : downloadReply(reply, suggestedFileName); - return; - } - - if (!isLocal) - { + return; + } - KParts::BrowserOpenOrSaveQuestion dlg(Application::instance()->mainWindow(), replyUrl, mimeType); - if(!suggestedFileName.isEmpty()) - dlg.setSuggestedFileName(suggestedFileName); - - switch (dlg.askEmbedOrSave()) - { - case KParts::BrowserOpenOrSaveQuestion::Save: - kDebug() << "service handling: download!"; - downloadThings(reply->request(), suggestedFileName); - return; + if (!isLocal) + { - case KParts::BrowserOpenOrSaveQuestion::Cancel: - return; + KParts::BrowserOpenOrSaveQuestion dlg(Application::instance()->mainWindow(), replyUrl, mimeType); + if(!suggestedFileName.isEmpty()) + dlg.setSuggestedFileName(suggestedFileName); + + switch (dlg.askEmbedOrSave()) + { + case KParts::BrowserOpenOrSaveQuestion::Save: + kDebug() << "user choice: no services, just download!"; + downloadReply(reply, suggestedFileName); + return; - default: // non extant case - break; - } - } + case KParts::BrowserOpenOrSaveQuestion::Cancel: + return; - // case KParts::BrowserRun::Embed - KService::List partServices = KMimeTypeTrader::self()->query(mimeType, QL1S("KParts/ReadOnlyPart")); - if (partServices.count() > 0) - { - QString p = replyUrl.pathOrUrl(); - - // A part can handle this. Embed it! - QString html; - html += "<html>"; - html += "<head>"; - html += "<title>"; - html += p; - html += "</title>"; - html += "<style type=\"text/css\">"; - html += "* { border: 0; padding: 0; margin: 0; }"; - html += "</style>"; - html += "</head>"; - html += "<body>"; - html += "<object type=\"" + mimeType + "\" data=\"" + p + "\" width=\"100%\" height=\"100%\" />"; - html += "</body>"; - html += "</html>"; - - mainFrame()->setHtml(html); - _isOnRekonqPage = true; - kDebug() << "EMBED true"; - Application::instance()->mainWindow()->mainView()->urlBar()->setQUrl(replyUrl); - Application::instance()->mainWindow()->updateActions(); - } - else - { - // No parts, just app services. Load it! - KRun::run(*appService, replyUrl, 0); + default: // non extant case + break; } + } - return; + // case KParts::BrowserRun::Embed + KService::List partServices = KMimeTypeTrader::self()->query(mimeType, QL1S("KParts/ReadOnlyPart")); + if (partServices.count() > 0) + { + QString p = replyUrl.pathOrUrl(); + + // A part can handle this. Embed it! + QString html; + html += "<html>"; + html += "<head>"; + html += "<title>"; + html += p; + html += "</title>"; + html += "<style type=\"text/css\">"; + html += "* { border: 0; padding: 0; margin: 0; }"; + html += "</style>"; + html += "</head>"; + html += "<body>"; + html += "<object type=\"" + mimeType + "\" data=\"" + p + "\" width=\"100%\" height=\"100%\" />"; + html += "</body>"; + html += "</html>"; + + mainFrame()->setHtml(html); + _isOnRekonqPage = true; + Application::instance()->mainWindow()->mainView()->urlBar()->setQUrl(replyUrl); + Application::instance()->mainWindow()->updateActions(); } + else + { + // No parts, just app services. Load it! + KRun::run(*appService, replyUrl, 0); + } + + return; } @@ -392,7 +493,7 @@ void WebPage::manageNetworkErrors(QNetworkReply *reply) && !domainSchemeMatch(reply->url(), _sslInfo.url()) ) { - //kDebug() << "Reseting cached SSL info..."; + // Reseting cached SSL info... _sslInfo = WebSslInfo(); } @@ -410,34 +511,37 @@ void WebPage::manageNetworkErrors(QNetworkReply *reply) } break; + case QNetworkReply::OperationCanceledError: // operation canceled via abort() or close() calls + // ignore this.. + return; + case QNetworkReply::ContentAccessDenied: // access to remote content denied (similar to HTTP error 401) kDebug() << "We (hopefully) are managing this through the adblock :)"; break; case QNetworkReply::UnknownNetworkError: // unknown network-related error detected - if (_protHandler.postHandling(reply->request(), mainFrame())) - break; + _protHandler.postHandling(reply->request(), mainFrame()); + return; case QNetworkReply::ConnectionRefusedError: // remote server refused connection case QNetworkReply::HostNotFoundError: // invalid hostname case QNetworkReply::TimeoutError: // connection time out - case QNetworkReply::OperationCanceledError: // operation canceled via abort() or close() calls case QNetworkReply::ProxyNotFoundError: // invalid proxy hostname case QNetworkReply::ContentOperationNotPermittedError: // operation requested on remote content not permitted case QNetworkReply::ContentNotFoundError: // remote content not found on server (similar to HTTP error 404) case QNetworkReply::ProtocolUnknownError: // Unknown protocol case QNetworkReply::ProtocolInvalidOperationError: // requested operation is invalid for this protocol + kDebug() << "ERROR " << reply->error() << ": " << reply->errorString(); if (reply->url() == _loadingUrl) { mainFrame()->setHtml(errorPage(reply)); _isOnRekonqPage = true; - kDebug() << "ERROR true"; } break; default: - kDebug() << "Nothing to do here.."; + // Nothing to do here.. break; } @@ -487,89 +591,23 @@ QString WebPage::errorPage(QNetworkReply *reply) } -// WARNING -// this code is actually copied from KWebPage::downloadRequest to save -// downloads data before. If you have some better ideas about, -// feel free to let us know about :) -void WebPage::downloadThings(const QNetworkRequest &request, const QString &suggestedFileName) +void WebPage::downloadReply(const QNetworkReply *reply, const QString &suggestedFileName) { - KUrl destUrl; - KUrl srcUrl(request.url()); - - if( !ReKonfig::kgetDownload() && suggestedFileName.isEmpty() ) - { - kDebug() << "Using KWebPage downloadRequest.."; - Application::historyManager()->addDownload(srcUrl.pathOrUrl() , destUrl.pathOrUrl()); - KWebPage::downloadRequest(request); - return; - } - - int result = KIO::R_OVERWRITE; - - do - { - QString fName = suggestedFileName.isEmpty() - ? srcUrl.fileName() - : suggestedFileName; - - destUrl = KFileDialog::getSaveFileName(fName, QString(), view()); - - if (destUrl.isLocalFile()) - { - QFileInfo finfo(destUrl.toLocalFile()); - if (finfo.exists()) - { - QDateTime now = QDateTime::currentDateTime(); - QPointer<KIO::RenameDialog> dlg = new KIO::RenameDialog(view(), - i18n("Overwrite File?"), - srcUrl, - destUrl, - KIO::RenameDialog_Mode(KIO::M_OVERWRITE | KIO::M_SKIP), - -1, - finfo.size(), - now.toTime_t(), - finfo.created().toTime_t(), - now.toTime_t(), - finfo.lastModified().toTime_t() - ); - result = dlg->exec(); - delete dlg; - } - } - } - while (result == KIO::R_CANCEL && destUrl.isValid()); + downloadResource( reply->url(), KIO::MetaData(), view(), suggestedFileName); +} - if (result == KIO::R_OVERWRITE && destUrl.isValid()) - { - // now store data - // now, destUrl, srcUrl - Application::historyManager()->addDownload(srcUrl.pathOrUrl() , destUrl.pathOrUrl()); - if (ReKonfig::kgetDownload()) - { - //KGet integration: - if (!QDBusConnection::sessionBus().interface()->isServiceRegistered("org.kde.kget")) - { - KToolInvocation::kdeinitExecWait("kget"); - } - QDBusInterface kget("org.kde.kget", "/KGet", "org.kde.kget.main"); - if (kget.isValid()) - { - kget.call("addTransfer", srcUrl.prettyUrl(), destUrl.prettyUrl(), true); - return; - } - } +void WebPage::downloadRequest(const QNetworkRequest &request) +{ + downloadResource(request.url(), + request.attribute(static_cast<QNetworkRequest::Attribute>(KIO::AccessManager::MetaData)).toMap(), + view()); +} - // else, use KIO or fallback to it - KIO::Job *job = KIO::file_copy(srcUrl, destUrl, -1, KIO::Overwrite); - QVariant attr = request.attribute(static_cast<QNetworkRequest::Attribute>(KIO::AccessManager::MetaData)); - if (attr.isValid() && attr.type() == QVariant::Map) - job->setMetaData(KIO::MetaData(attr.toMap())); - job->addMetaData(QL1S("MaxCacheSize"), QL1S("0")); // Don't store in http cache. - job->addMetaData(QL1S("cache"), QL1S("cache")); // Use entry from cache if available. - job->uiDelegate()->setAutoErrorHandlingEnabled(true); - } +void WebPage::downloadUrl(const KUrl &url) +{ + downloadResource( url, KIO::MetaData(), view() ); } @@ -580,14 +618,14 @@ void WebPage::downloadAllContentsWithKGet(QPoint) KUrl relativeUrl; QWebElementCollection images = mainFrame()->documentElement().findAll("img"); - foreach(QWebElement img, images) + foreach(const QWebElement &img, images) { relativeUrl.setEncodedUrl(img.attribute("src").toUtf8(), KUrl::TolerantMode); contents << baseUrl.resolved(relativeUrl).toString(); } QWebElementCollection links = mainFrame()->documentElement().findAll("a"); - foreach(QWebElement link, links) + foreach(const QWebElement &link, links) { relativeUrl.setEncodedUrl(link.attribute("href").toUtf8(), KUrl::TolerantMode); contents << baseUrl.resolved(relativeUrl).toString(); diff --git a/src/webpage.h b/src/webpage.h index eff4c3fc..f3d201c2 100644 --- a/src/webpage.h +++ b/src/webpage.h @@ -68,7 +68,10 @@ public: public slots: void downloadAllContentsWithKGet(QPoint); - + + virtual void downloadRequest(const QNetworkRequest &request); + virtual void downloadUrl(const KUrl &url); + protected: WebPage *createWindow(WebWindowType type); @@ -83,13 +86,7 @@ private slots: void showSSLInfo(QPoint); void updateImage(bool ok); - /** - * This new slot is needed to provide integration between rekonq & KGet, - * to better manage file names and to not overwrite KWebPage default behavior on need - * - * @see KWebPage::downloadRequest. - */ - void downloadThings(const QNetworkRequest &request, const QString &suggestedFileName = QString()); + void downloadReply(const QNetworkReply *reply, const QString &suggestedFileName = QString()); private: QString errorPage(QNetworkReply *reply); diff --git a/src/webtab.cpp b/src/webtab.cpp index a6bedc97..9e168d36 100644 --- a/src/webtab.cpp +++ b/src/webtab.cpp @@ -124,6 +124,7 @@ KUrl WebTab::url() void WebTab::updateProgress(int p) { m_progress = p; + emit loadProgressing(); } @@ -183,7 +184,7 @@ void WebTab::showRSSInfo(QPoint pos) QMap<KUrl, QString> map; - foreach(QWebElement el, col) + foreach(const QWebElement &el, col) { QString urlString; if (el.attribute("href").startsWith(QL1S("http"))) diff --git a/src/webtab.h b/src/webtab.h index bc07a3e9..e34bbccf 100644 --- a/src/webtab.h +++ b/src/webtab.h @@ -67,6 +67,9 @@ private slots: void createWalletBar(const QString &, const QUrl &); void showRSSInfo(QPoint pos); +signals: + void loadProgressing(); + private: WebView *_view; diff --git a/src/webview.cpp b/src/webview.cpp index 99c48f0b..061dd256 100644 --- a/src/webview.cpp +++ b/src/webview.cpp @@ -77,7 +77,7 @@ WebView::WebView(QWidget* parent) // download system connect(this, SIGNAL(linkShiftClicked(const KUrl &)), page, SLOT(downloadUrl(const KUrl &))); - connect(page, SIGNAL(downloadRequested(const QNetworkRequest &)), page, SLOT(downloadThings(const QNetworkRequest &))); + connect(page, SIGNAL(downloadRequested(const QNetworkRequest &)), page, SLOT(downloadRequest(const QNetworkRequest &))); // middle click || ctrl + click signal connect(this, SIGNAL(linkMiddleOrCtrlClicked(const KUrl &)), this, SLOT(loadUrlInNewTab(const KUrl &))); @@ -316,7 +316,7 @@ void WebView::mousePressEvent(QMouseEvent *event) } QWebHitTestResult result = page()->mainFrame()->hitTestContent(event->pos()); - _canEnableAutoScroll = !ReKonfig::disableAutoScroll() && !result.isContentEditable() && result.linkUrl().isEmpty(); + _canEnableAutoScroll = ReKonfig::autoScroll() && !result.isContentEditable() && result.linkUrl().isEmpty(); switch (event->button()) { @@ -496,6 +496,23 @@ void WebView::keyPressEvent(QKeyEvent *event) KWebView::keyPressEvent(event); } +void WebView::wheelEvent(QWheelEvent *event) +{ + // Sync with the zoom slider + if (event->modifiers() == Qt::ControlModifier) + { + emit zoomChanged(zoomFactor()); + } + + KWebView::wheelEvent(event); + + // Limits of the slider + if (zoomFactor() > 1.9) + setZoomFactor(1.9); + else if (zoomFactor() < 0.1) + setZoomFactor(0.1); +} + void WebView::inspect() { diff --git a/src/webview.h b/src/webview.h index bac12e99..a4ba676c 100644 --- a/src/webview.h +++ b/src/webview.h @@ -56,6 +56,7 @@ protected: void mousePressEvent(QMouseEvent *event); void mouseMoveEvent(QMouseEvent *event); void keyPressEvent(QKeyEvent *event); + void wheelEvent(QWheelEvent *event); private slots: void search(); @@ -73,6 +74,7 @@ private slots: signals: void loadUrl(const KUrl &, const Rekonq::OpenType &); + void zoomChanged(qreal); private: QPoint _mousePos; |