diff options
author | Domrachev Alexandr <alexandr.domrachev@gmail.com> | 2009-06-27 19:17:11 +0400 |
---|---|---|
committer | Domrachev Alexandr <alexandr.domrachev@gmail.com> | 2009-06-27 19:17:11 +0400 |
commit | 625d68593076158ab88ae34dbe14ebe96266085a (patch) | |
tree | c4f1348c11c4c29ad14939018c13a9bbdeb192e0 | |
parent | Merge branch 'master' of git@gitorious.org:~avaddon/rekonq/avaddon-clone.git (diff) | |
parent | Fixing popup pos && removing unwanted statusBar (diff) | |
download | rekonq-625d68593076158ab88ae34dbe14ebe96266085a.tar.xz |
Merge branch 'master' of git@gitorious.org:~avaddon/rekonq/avaddon-clone.git
* 'master' of git@gitorious.org:~avaddon/rekonq/avaddon-clone.git:
Fixing popup pos && removing unwanted statusBar
0.1.6 version with new notifying system
New notifying system. Perhaps this should be default for
Deleting popup in empty msg
Comments and Fixes
New notify system
Working on new notify system...
start moving things..
slot Save File As
Finally fixed F5 shortcut
New history menu code comments
history menu fix
-rw-r--r-- | CMakeLists.txt | 2 | ||||
-rw-r--r-- | icons/CMakeLists.txt | 2 | ||||
-rw-r--r-- | icons/pics/CMakeLists.txt | 4 | ||||
-rw-r--r-- | icons/pics/hi64-actions-download.png | bin | 0 -> 4518 bytes | |||
-rw-r--r-- | src/application.cpp | 1 | ||||
-rw-r--r-- | src/application.h | 13 | ||||
-rw-r--r-- | src/main.cpp | 2 | ||||
-rw-r--r-- | src/mainview.cpp | 25 | ||||
-rw-r--r-- | src/mainview.h | 6 | ||||
-rw-r--r-- | src/mainwindow.cpp | 86 | ||||
-rw-r--r-- | src/mainwindow.h | 34 | ||||
-rw-r--r-- | src/modelmenu.cpp | 36 | ||||
-rw-r--r-- | src/rekonqui.rc | 5 | ||||
-rw-r--r-- | src/webpage.cpp | 2 | ||||
-rw-r--r-- | src/webpage.h | 6 |
15 files changed, 151 insertions, 73 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt index 8b246296..9b3d7ff4 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -9,7 +9,7 @@ PROJECT( rekonq ) # rekonq info SET(REKONQ_MAJOR_VERSION "0") SET(REKONQ_MINOR_VERSION "1") -SET(REKONQ_PATCH_VERSION "5") +SET(REKONQ_PATCH_VERSION "6") SET(REKONQ_VERSION_STR "${REKONQ_MAJOR_VERSION}.${REKONQ_MINOR_VERSION}.${REKONQ_PATCH_VERSION}" diff --git a/icons/CMakeLists.txt b/icons/CMakeLists.txt index 9d7ead58..d575cf4d 100644 --- a/icons/CMakeLists.txt +++ b/icons/CMakeLists.txt @@ -1,2 +1,4 @@ # install standard icons KDE4_INSTALL_ICONS( ${ICON_INSTALL_DIR} ) + +ADD_SUBDIRECTORY( pics ) diff --git a/icons/pics/CMakeLists.txt b/icons/pics/CMakeLists.txt new file mode 100644 index 00000000..53d04224 --- /dev/null +++ b/icons/pics/CMakeLists.txt @@ -0,0 +1,4 @@ +INSTALL( + FILES hi64-actions-download.png + DESTINATION ${DATA_INSTALL_DIR}/rekonq/pics +) diff --git a/icons/pics/hi64-actions-download.png b/icons/pics/hi64-actions-download.png Binary files differnew file mode 100644 index 00000000..aa1101c1 --- /dev/null +++ b/icons/pics/hi64-actions-download.png diff --git a/src/application.cpp b/src/application.cpp index 6f479d62..bc77f60a 100644 --- a/src/application.cpp +++ b/src/application.cpp @@ -42,6 +42,7 @@ #include <KConfig> #include <kio/job.h> #include <kio/jobclasses.h> +#include <KPassivePopup> // Qt Includes #include <QtCore/QTimer> diff --git a/src/application.h b/src/application.h index 7f3e6f3b..46d013e3 100644 --- a/src/application.h +++ b/src/application.h @@ -58,6 +58,19 @@ namespace Rekonq New, ///< open url in new tab and make it current Background ///< open url in new tab in background }; + + /** + * @short notifying message status + * Different message status + */ + + enum Notify + { + Success, ///< url successfully (down)loaded + Error, ///< url failed to (down)load + Download, ///< downloading url + Info ///< information, (default) + }; } diff --git a/src/main.cpp b/src/main.cpp index 6a4e9a6f..d97017ca 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -31,7 +31,7 @@ static const char description[] = I18N_NOOP("WebKit based Web Browser for KDE"); -static const char version[] = "0.1.5"; +static const char version[] = "0.1.6"; int main(int argc, char **argv) diff --git a/src/mainview.cpp b/src/mainview.cpp index 636a4812..79afd2dc 100644 --- a/src/mainview.cpp +++ b/src/mainview.cpp @@ -303,7 +303,7 @@ void MainView::slotCurrentChanged(int index) WebView *oldWebView = this->webView(m_urlBars->currentIndex()); if (oldWebView) { - disconnect(oldWebView, SIGNAL(statusBarMessage(const QString&)), + disconnect(oldWebView->page(), SIGNAL(statusBarMessage(const QString&)), this, SIGNAL(showStatusBarMessage(const QString&))); disconnect(oldWebView->page(), SIGNAL(linkHovered(const QString&, const QString&, const QString&)), this, SIGNAL(linkHovered(const QString&))); @@ -311,7 +311,7 @@ void MainView::slotCurrentChanged(int index) this, SIGNAL(loadProgress(int))); } - connect(webView, SIGNAL(statusBarMessage(const QString&)), this, SIGNAL(showStatusBarMessage(const QString&))); + connect(webView->page(), SIGNAL(statusBarMessage(const QString&)), this, SIGNAL(showStatusBarMessage(const QString&))); connect(webView->page(), SIGNAL(linkHovered(const QString&, const QString&, const QString&)), this, SIGNAL(linkHovered(const QString&))); connect(webView, SIGNAL(loadProgress(int)), this, SIGNAL(loadProgress(int))); @@ -371,7 +371,6 @@ WebView *MainView::newWebView(Rekonq::OpenType type) // connecting webview with mainview connect(webView, SIGNAL(loadStarted()), this, SLOT(webViewLoadStarted())); - connect(webView, SIGNAL(loadProgress(int)), this, SLOT(webViewLoadProgress(int))); connect(webView, SIGNAL(loadFinished(bool)), this, SLOT(webViewLoadFinished(bool))); connect(webView, SIGNAL(iconChanged()), this, SLOT(webViewIconChanged())); connect(webView, SIGNAL(titleChanged(const QString &)), this, SLOT(webViewTitleChanged(const QString &))); @@ -552,22 +551,6 @@ void MainView::webViewLoadStarted() } -void MainView::webViewLoadProgress(int progress) -{ - WebView *webView = qobject_cast<WebView*>(sender()); - int index = webViewIndex(webView); - if (index != currentIndex() || index < 0) - { - return; - } - - double totalBytes = static_cast<double>(webView->page()->totalBytes() / 1024); - - QString message = i18n("Loading %1% (%2 %3)...", progress, totalBytes, QLatin1String("kB")); - emit showStatusBarMessage(message); -} - - void MainView::webViewLoadFinished(bool ok) { WebView *webView = qobject_cast<WebView*>(sender()); @@ -590,9 +573,9 @@ void MainView::webViewLoadFinished(bool ok) } if (ok) - emit showStatusBarMessage(i18n("Done")); + emit showStatusBarMessage(i18n("Done"), Rekonq::Success); else - emit showStatusBarMessage(i18n("Failed to load")); + emit showStatusBarMessage(i18n("Failed to load"), Rekonq::Error); } diff --git a/src/mainview.h b/src/mainview.h index 9ee2f12a..7cb4e035 100644 --- a/src/mainview.h +++ b/src/mainview.h @@ -91,7 +91,7 @@ signals: // current tab signals void setCurrentTitle(const QString &url); - void showStatusBarMessage(const QString &message); + void showStatusBarMessage(const QString &message, Rekonq::Notify status = Rekonq::Info); void linkHovered(const QString &link); void loadProgress(int progress); @@ -112,6 +112,7 @@ public slots: * @param url The url to load */ void loadUrl(const KUrl &url); + void slotCloneTab(int index = -1); void slotCloseTab(int index = -1); void slotCloseOtherTabs(int index); @@ -133,11 +134,8 @@ public slots: private slots: void slotCurrentChanged(int index); -// void aboutToShow/*Rec*/entTabsMenu(); -// void aboutToShowRecentTriggeredAction(QAction *action); // need QAction! void webViewLoadStarted(); - void webViewLoadProgress(int progress); void webViewLoadFinished(bool ok); void webViewIconChanged(); void webViewTitleChanged(const QString &title); diff --git a/src/mainwindow.cpp b/src/mainwindow.cpp index 4f9d0711..2c46dc01 100644 --- a/src/mainwindow.cpp +++ b/src/mainwindow.cpp @@ -57,6 +57,10 @@ #include <KGlobalSettings> #include <KPushButton> #include <KTemporaryFile> +#include <KJobUiDelegate> +#include <KPassivePopup> +#include <KStandardDirs> +#include <KIconLoader> #include <kdeprintdialog.h> #include <kprintpreview.h> @@ -132,6 +136,9 @@ MainWindow::MainWindow() // toolbar position, icon size, etc. setupGUI(); + // no more status bar.. + setStatusBar(0); + QTimer::singleShot(0, this, SLOT(postLaunch())); } @@ -158,9 +165,9 @@ void MainWindow::postLaunch() connect(m_view, SIGNAL(loadProgress(int)), this, SLOT(slotLoadProgress(int))); connect(m_view, SIGNAL(printRequested(QWebFrame *)), this, SLOT(printRequested(QWebFrame *))); - // status bar messages - connect(m_view, SIGNAL(showStatusBarMessage(const QString&)), statusBar(), SLOT(showMessage(const QString&))); - connect(m_view, SIGNAL(linkHovered(const QString&)), statusBar(), SLOT(showMessage(const QString&))); + // "status bar" messages (new notifyMessage system) + connect(m_view, SIGNAL(showStatusBarMessage(const QString&, Rekonq::Notify)), this, SLOT(notifyMessage(const QString&, Rekonq::Notify))); + connect(m_view, SIGNAL(linkHovered(const QString&)), this, SLOT(notifyMessage(const QString&))); // update toolbar actions signals connect(m_view, SIGNAL(tabsChanged()), this, SLOT(slotUpdateActions())); @@ -251,7 +258,6 @@ void MainWindow::setupActions() // stop reload Action m_stopReloadAction = new KAction(KIcon("view-refresh"), i18n("Reload"), this); - m_stopReloadAction->setShortcut(KShortcut(Qt::Key_F5)); actionCollection()->addAction(QLatin1String("stop_reload") , m_stopReloadAction); m_stopReloadAction->setShortcutConfigurable(false); @@ -349,7 +355,6 @@ void MainWindow::setupHistoryMenu() { HistoryMenu *historyMenu = new HistoryMenu(this); connect(historyMenu, SIGNAL(openUrl(const KUrl&)), this, SLOT(loadUrl(const KUrl&))); - connect(historyMenu, SIGNAL(hovered(const QString&)), this, SLOT(slotUpdateStatusbar(const QString&))); historyMenu->setTitle(i18n("&History")); // setting history menu position @@ -427,7 +432,13 @@ void MainWindow::slotOpenLocation() void MainWindow::slotFileSaveAs() { KUrl srcUrl = currentTab()->url(); - // FIXME implement download file + + const QString destUrl = KFileDialog::getSaveFileName(srcUrl.fileName(), QString(), this); + if (destUrl.isEmpty()) return; + KIO::Job *job = KIO::file_copy(srcUrl, KUrl(destUrl), -1, KIO::Overwrite); + job->addMetaData("MaxCacheSize", "0"); // Don't store in http cache. + job->addMetaData("cache", "cache"); // Use entry from cache if available. + job->uiDelegate()->setAutoErrorHandlingEnabled(true); } @@ -449,12 +460,6 @@ void MainWindow::slotPreferences() } -void MainWindow::slotUpdateStatusbar(const QString &string) -{ - statusBar()->showMessage(string, 2000); -} - - void MainWindow::slotUpdateActions() { m_historyBackAction->setEnabled(currentTab()->history()->canGoBack()); @@ -578,7 +583,7 @@ void MainWindow::slotFindNext() if (!currentTab()->findText(m_lastSearch, options)) { - slotUpdateStatusbar(QString(m_lastSearch) + i18n(" not found.")); + notifyMessage(QString(m_lastSearch) + i18n(" not found.")); } } @@ -594,7 +599,7 @@ void MainWindow::slotFindPrevious() if (!currentTab()->findText(m_lastSearch, options)) { - slotUpdateStatusbar(QString(m_lastSearch) + i18n(" not found.")); + notifyMessage(QString(m_lastSearch) + i18n(" not found.")); } } @@ -629,7 +634,6 @@ void MainWindow::slotViewFullScreen(bool makeFullScreen) static bool menubarFlag; static bool mainToolBarFlag; static bool bookmarksToolBarFlag; - static bool statusBarFlag; static bool sidePanelFlag; if (makeFullScreen == true) @@ -638,13 +642,11 @@ void MainWindow::slotViewFullScreen(bool makeFullScreen) menubarFlag = menuBar()->isHidden(); mainToolBarFlag = toolBar("mainToolBar")->isHidden(); bookmarksToolBarFlag = toolBar("bookmarksToolBar")->isHidden(); - statusBarFlag = statusBar()->isHidden(); sidePanelFlag = sidePanel()->isHidden(); menuBar()->hide(); toolBar("mainToolBar")->hide(); toolBar("bookmarksToolBar")->hide(); - statusBar()->hide(); sidePanel()->hide(); } else @@ -655,8 +657,6 @@ void MainWindow::slotViewFullScreen(bool makeFullScreen) toolBar("mainToolBar")->show(); if (!bookmarksToolBarFlag) toolBar("bookmarksToolBar")->show(); - if (!statusBarFlag) - statusBar()->show(); if (!sidePanelFlag) sidePanel()->show(); } @@ -839,3 +839,51 @@ QAction *MainWindow::actionByName(const QString name) return new QAction(this); // return empty object instead of NULL pointer } + + +// FIXME: better implement me, please!! +void MainWindow::notifyMessage(const QString &msg, Rekonq::Notify status) +{ + // deleting popus if empty msgs + if(msg.isEmpty()) + { + delete m_popup; + return; + } + + if(m_popup) + delete m_popup; + + m_popup = new KPassivePopup(this); + m_popup->setAutoDelete(true); + + QPixmap px; + QString pixPath; + + switch(status) + { + case Rekonq::Info: + break; + case Rekonq::Success: + break; + case Rekonq::Error: + break; + case Rekonq::Download: + break; + default: + kDebug() << "nothing to be notified.."; + break; + } + + m_popup->setView(msg); + + int h = KGlobalSettings::generalFont().pointSize(); + kWarning() << "h: " << h; + + // setting popus in bottom-left position + int x = geometry().x(); + int y = geometry().y() + height() - h*4; + QPoint p(x,y); + + m_popup->show(p); +} diff --git a/src/mainwindow.h b/src/mainwindow.h index aade6fd8..b276a544 100644 --- a/src/mainwindow.h +++ b/src/mainwindow.h @@ -41,6 +41,7 @@ class KUrl; class KAction; class KActionMenu; class KMenu; +class KPassivePopup; class HistoryMenu; class FindBar; @@ -48,6 +49,23 @@ class SidePanel; class WebView; +// namespace Rekonq +// { +// /** +// * @short notifying message status +// * Different message status +// */ +// +// enum Notify +// { +// Success, ///< url successfully (down)loaded +// Error, ///< url failed to (down)load +// Download, ///< downloading url +// Info ///< information, (default) +// }; +// } + + /** * This class serves as the main window for rekonq. * It handles the menus, toolbars, and status bars. @@ -78,6 +96,17 @@ public slots: void loadUrl(const KUrl &url); void slotUpdateBrowser(); + /** + * Notifies a message in a popup + * + * @param msg The message to notify + * + * @param status The status message + * + */ + void notifyMessage(const QString &msg, Rekonq::Notify status = Rekonq::Info); + + protected: bool queryClose(); @@ -85,15 +114,12 @@ private slots: void postLaunch(); void slotUpdateConfiguration(); void slotLoadProgress(int); - void slotUpdateStatusbar(const QString &string); void slotUpdateActions(); void slotUpdateWindowTitle(const QString &title = QString()); void slotOpenLocation(); -// void slotAboutToShowBackMenu(); void geometryChangeRequested(const QRect &geometry); // history related -// void slotOpenActionUrl(QAction *action); void slotOpenPrevious(); void slotOpenNext(); @@ -141,6 +167,8 @@ private: QString m_lastSearch; QString m_homePage; + + QPointer<KPassivePopup> m_popup; }; #endif // MAINWINDOW_H diff --git a/src/modelmenu.cpp b/src/modelmenu.cpp index 8f174797..41c197f3 100644 --- a/src/modelmenu.cpp +++ b/src/modelmenu.cpp @@ -145,19 +145,25 @@ void ModelMenu::aboutToShow() postPopulated(); } + +// WARNING +// the code commented out here is to create a second separator in the history menu +// with ALL history, subdivided by days. void ModelMenu::createMenu(const QModelIndex &parent, int max, QMenu *parentMenu, QMenu *menu) { + Q_UNUSED(parentMenu) + if (!menu) { - QString title = parent.data().toString(); - menu = new QMenu(title, this); - QIcon icon = qvariant_cast<QIcon>(parent.data(Qt::DecorationRole)); - menu->setIcon(icon); - parentMenu->addMenu(menu); - QVariant v; - v.setValue(parent); - menu->menuAction()->setData(v); - connect(menu, SIGNAL(aboutToShow()), this, SLOT(aboutToShow())); +// QString title = parent.data().toString(); +// menu = new QMenu(title, this); +// QIcon icon = qvariant_cast<QIcon>(parent.data(Qt::DecorationRole)); +// menu->setIcon(icon); +// parentMenu->addMenu(menu); +// QVariant v; +// v.setValue(parent); +// menu->menuAction()->setData(v); +// connect(menu, SIGNAL(aboutToShow()), this, SLOT(aboutToShow())); return; } @@ -171,12 +177,12 @@ void ModelMenu::createMenu(const QModelIndex &parent, int max, QMenu *parentMenu for (int i = 0; i < end; ++i) { QModelIndex idx = m_model->index(i, 0, parent); -/* if (m_model->hasChildren(idx)) - { - createMenu(idx, -1, menu); - } - else - {*/ +// if (m_model->hasChildren(idx)) +// { +// createMenu(idx, -1, menu); +// } +// else +// { if (m_separatorRole != 0 && idx.data(m_separatorRole).toBool()) addSeparator(); diff --git a/src/rekonqui.rc b/src/rekonqui.rc index 2a366229..dfc8bd2b 100644 --- a/src/rekonqui.rc +++ b/src/rekonqui.rc @@ -1,6 +1,6 @@ <?xml version="1.0"?> <!DOCTYPE gui SYSTEM "kpartgui.dtd"> -<gui name="rekonq" version="41"> +<gui name="rekonq" version="42"> <MenuBar> @@ -36,7 +36,7 @@ <!-- ============ VIEW menu =========== --> <Menu name="view" noMerge="1"><text>&View</text> - <Action name="stop_reload" /> + <Action name="view_redisplay" /> <Action name="go_home" /> <Separator/> <Action name="bigger_font" /> @@ -67,7 +67,6 @@ <!-- ============ SETTINGS menu =========== --> <Menu name="settings" noMerge="1"><text>&Settings</text> <Action name="options_show_menubar" /> - <Action name="options_show_statusbar" /> <Merge name="StandardToolBarMenuHandler" /> <Merge/> <Separator/> diff --git a/src/webpage.cpp b/src/webpage.cpp index 39511760..8c6c0d2a 100644 --- a/src/webpage.cpp +++ b/src/webpage.cpp @@ -141,7 +141,7 @@ void WebPage::slotHandleUnsupportedContent(QNetworkReply *reply) KParts::BrowserRun::AskSaveResult res = KParts::BrowserRun::askSave( url, offer, - mimetype, + mimetype, filename ); switch (res) diff --git a/src/webpage.h b/src/webpage.h index 8ed53a2d..8fe9517d 100644 --- a/src/webpage.h +++ b/src/webpage.h @@ -3,9 +3,7 @@ * This file is a part of the rekonq project * * Copyright (C) 2007-2008 Trolltech ASA. All rights reserved -* Copyright (C) 2008 Benjamin C. Meyer <ben@meyerhome.net> * Copyright (C) 2008-2009 by Andrea Diamantini <adjam7 at gmail dot com> -* Copyright (C) 2009 by Paweł Prażak <pawelprazak at gmail dot com> * * * This program is free software; you can redistribute it @@ -24,6 +22,7 @@ #ifndef WEBPAGE_H #define WEBPAGE_H + // KDE Includes #include <KUrl> @@ -34,13 +33,10 @@ #include <QWebPage> // Forward Declarations - - class QWebFrame; class QNetworkReply; - class WebPage : public KWebPage { Q_OBJECT |