summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorAndrea Diamantini <adjam7@gmail.com>2009-06-21 01:29:05 +0200
committerAndrea Diamantini <adjam7@gmail.com>2009-06-21 01:29:05 +0200
commit8e094f1119d4073e78697052397c42a90c527601 (patch)
treedc6d93eaff6c3fa8b5106520caf161fcb5606350 /src
parentWorking on new notify system... (diff)
downloadrekonq-8e094f1119d4073e78697052397c42a90c527601.tar.xz
New notify system
Diffstat (limited to 'src')
-rw-r--r--src/application.cpp26
-rw-r--r--src/application.h10
-rw-r--r--src/mainview.cpp30
-rw-r--r--src/mainview.h19
-rw-r--r--src/mainwindow.cpp67
-rw-r--r--src/mainwindow.h15
-rw-r--r--src/rekonqui.rc1
-rw-r--r--src/webpage.cpp2
-rw-r--r--src/webpage.h6
9 files changed, 99 insertions, 77 deletions
diff --git a/src/application.cpp b/src/application.cpp
index b9b15acd..5b458438 100644
--- a/src/application.cpp
+++ b/src/application.cpp
@@ -253,29 +253,3 @@ KUrl Application::guessUrlFromString(const QString &string)
}
return url;
}
-
-
-void Application::notifyMsg(const QString &msg, Rekonq::Notify status)
-{
- QPixmap px;
-
- switch(status)
- {
- case Rekonq::Success:
- px.load("hi32-actions-emoticon.png");
- KPassivePopup::message( i18n("Success!"), msg, px, this, 2);
- break;
- case Rekonq::Error:
- px.load("hi32-actions-edit-delete.png");
- KPassivePopup::message( i18n("Error!"), msg, px, this, 2);
- break;
- case Rekonq::Download:
- QString path = KStandardDirs::locate("appdata", "pics/hi64-actions-download.png");
- px.load(path);
- KPassivePopup::message( i18n("Download!"), msg, px, this, 2);
- break;
- default:
- kDebug() << "nothing to be notified..";
- break;
- }
-}
diff --git a/src/application.h b/src/application.h
index 05db3ecb..a5658703 100644
--- a/src/application.h
+++ b/src/application.h
@@ -58,14 +58,6 @@ namespace Rekonq
New, ///< open url in new tab and make it current
Background ///< open url in new tab in background
};
-
- enum Notify
- {
- Success, ///< url successfully (down)loaded
- Error, ///< url failed to (down)load
- Download, ///< downloading url
- Info ///< information
- };
}
@@ -87,8 +79,6 @@ public:
KIcon icon(const KUrl &url) const;
- void notifyMsg(const QString &msg, Rekonq::Notify status);
-
static KUrl guessUrlFromString(const QString &url);
static HistoryManager *historyManager();
diff --git a/src/mainview.cpp b/src/mainview.cpp
index d6c97511..2db26988 100644
--- a/src/mainview.cpp
+++ b/src/mainview.cpp
@@ -371,7 +371,7 @@ 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(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 &)));
@@ -553,20 +553,20 @@ 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::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)
diff --git a/src/mainview.h b/src/mainview.h
index 36fadfb4..aad99ddd 100644
--- a/src/mainview.h
+++ b/src/mainview.h
@@ -47,6 +47,23 @@ class TabBar;
class UrlBar;
+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
+ };
+}
+
+
/**
* This class represent rekonq Main View. It contains all WebViews and a stack widget
* of associated line edits.
@@ -112,6 +129,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);
@@ -135,7 +153,6 @@ private slots:
void slotCurrentChanged(int index);
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 4e6ff643..ccd40e3c 100644
--- a/src/mainwindow.cpp
+++ b/src/mainwindow.cpp
@@ -58,6 +58,8 @@
#include <KPushButton>
#include <KTemporaryFile>
#include <KJobUiDelegate>
+#include <KPassivePopup>
+#include <KStandardDirs>
#include <kdeprintdialog.h>
#include <kprintpreview.h>
@@ -159,9 +161,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
+ connect(m_view, SIGNAL(showStatusBarMessage(const QString&)), this, SLOT(notifyMessage(const QString&)));
+ connect(m_view, SIGNAL(linkHovered(const QString&)), this, SLOT(notifyMessage(const QString&)));
// update toolbar actions signals
connect(m_view, SIGNAL(tabsChanged()), this, SLOT(slotUpdateActions()));
@@ -349,7 +351,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
@@ -455,12 +456,6 @@ void MainWindow::slotPreferences()
}
-void MainWindow::slotUpdateStatusbar(const QString &string)
-{
- statusBar()->showMessage(string, 2000);
-}
-
-
void MainWindow::slotUpdateActions()
{
m_historyBackAction->setEnabled(currentTab()->history()->canGoBack());
@@ -590,7 +585,7 @@ void MainWindow::slotFindNext()
if (!currentTab()->findText(m_lastSearch, options))
{
- slotUpdateStatusbar(QString(m_lastSearch) + i18n(" not found."));
+ notifyMessage(QString(m_lastSearch) + i18n(" not found."));
}
}
@@ -612,7 +607,7 @@ void MainWindow::slotFindPrevious()
if (!currentTab()->findText(m_lastSearch, options))
{
- slotUpdateStatusbar(QString(m_lastSearch) + i18n(" not found."));
+ notifyMessage(QString(m_lastSearch) + i18n(" not found."));
}
}
@@ -647,7 +642,6 @@ void MainWindow::slotViewFullScreen(bool makeFullScreen)
static bool menubarFlag;
static bool mainToolBarFlag;
static bool bookmarksToolBarFlag;
- static bool statusBarFlag;
static bool sidePanelFlag;
if (makeFullScreen == true)
@@ -656,13 +650,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
@@ -673,8 +665,6 @@ void MainWindow::slotViewFullScreen(bool makeFullScreen)
toolBar("mainToolBar")->show();
if (!bookmarksToolBarFlag)
toolBar("bookmarksToolBar")->show();
- if (!statusBarFlag)
- statusBar()->show();
if (!sidePanelFlag)
sidePanel()->show();
}
@@ -858,3 +848,46 @@ QAction *MainWindow::actionByName(const QString name)
return new QAction(this); // return empty object instead of NULL pointer
}
+
+
+void MainWindow::notifyMessage(const QString &msg, Rekonq::Notify status)
+{
+ if(msg.isEmpty())
+ return;
+
+ if(m_popup)
+ delete m_popup;
+
+ m_popup = new KPassivePopup(this);
+ m_popup->setAutoDelete(true);
+
+ QPixmap px;
+
+ switch(status)
+ {
+ case Rekonq::Info:
+ m_popup->setView(msg);
+ break;
+ case Rekonq::Success:
+ px.load("hi32-actions-emoticon.png");
+ m_popup->setView( i18n("Success!"), msg, px);
+ break;
+ case Rekonq::Error:
+ px.load("hi32-actions-edit-delete.png");
+ m_popup->setView( i18n("Error!"), msg, px);
+ break;
+ case Rekonq::Download:
+ px.load( KStandardDirs::locate("appdata", "pics/hi64-actions-download.png") );
+ m_popup->setView( i18n("Download!"), msg, px);
+ break;
+ default:
+ kDebug() << "nothing to be notified..";
+ break;
+ }
+
+ int x = geometry().x();
+ int y = geometry().y() + height() - 45;
+ QPoint p(x,y);
+
+ m_popup->show(p);
+}
diff --git a/src/mainwindow.h b/src/mainwindow.h
index d9180b69..51bea5e5 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;
@@ -78,6 +79,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,7 +97,6 @@ private slots:
void postLaunch();
void slotUpdateConfiguration();
void slotLoadProgress(int);
- void slotUpdateStatusbar(const QString &string);
void slotUpdateActions();
void slotUpdateWindowTitle(const QString &title = QString());
void slotOpenLocation();
@@ -139,6 +150,8 @@ private:
QString m_lastSearch;
QString m_homePage;
+
+ QPointer<KPassivePopup> m_popup;
};
#endif // MAINWINDOW_H
diff --git a/src/rekonqui.rc b/src/rekonqui.rc
index 6269df3b..67b07c1c 100644
--- a/src/rekonqui.rc
+++ b/src/rekonqui.rc
@@ -67,7 +67,6 @@
<!-- ============ SETTINGS menu =========== -->
<Menu name="settings" noMerge="1"><text>&amp;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