summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndrea Diamantini <adjam7@gmail.com>2009-06-21 22:11:39 +0200
committerAndrea Diamantini <adjam7@gmail.com>2009-06-21 22:11:39 +0200
commit9501cf849628c5aeef669f12db87d43ed03c357a (patch)
treeceb5c24d0c17feb94414fb66b40eb0694fdbc1e7
parentDeleting popup in empty msg (diff)
downloadrekonq-9501cf849628c5aeef669f12db87d43ed03c357a.tar.xz
New notifying system. Perhaps this should be default for
rekonq 0.2. Anyway, there are a lot of improvements needed. We'll see..
-rw-r--r--src/application.h13
-rw-r--r--src/mainview.cpp21
-rw-r--r--src/mainview.h2
-rw-r--r--src/mainwindow.cpp16
-rw-r--r--src/mainwindow.h30
5 files changed, 39 insertions, 43 deletions
diff --git a/src/application.h b/src/application.h
index a5658703..d2e66d3f 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/mainview.cpp b/src/mainview.cpp
index 05a32e7d..75154528 100644
--- a/src/mainview.cpp
+++ b/src/mainview.cpp
@@ -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 &)));
@@ -553,22 +552,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());
@@ -591,9 +574,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 91a09e09..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);
diff --git a/src/mainwindow.cpp b/src/mainwindow.cpp
index 811d607b..c7e3c945 100644
--- a/src/mainwindow.cpp
+++ b/src/mainwindow.cpp
@@ -60,6 +60,7 @@
#include <KJobUiDelegate>
#include <KPassivePopup>
#include <KStandardDirs>
+#include <KIconLoader>
#include <kdeprintdialog.h>
#include <kprintpreview.h>
@@ -162,7 +163,7 @@ void MainWindow::postLaunch()
connect(m_view, SIGNAL(printRequested(QWebFrame *)), this, SLOT(printRequested(QWebFrame *)));
// "status bar" messages (new notifyMessage system)
- connect(m_view, SIGNAL(showStatusBarMessage(const QString&)), this, SLOT(notifyMessage(const QString&)));
+ 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
@@ -850,8 +851,10 @@ QAction *MainWindow::actionByName(const QString name)
}
+// 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;
@@ -865,29 +868,26 @@ void MainWindow::notifyMessage(const QString &msg, Rekonq::Notify status)
m_popup->setAutoDelete(true);
QPixmap px;
+ QString pixPath;
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;
}
+ m_popup->setView(msg);
+
+ // setting popus in bottom-left position
int x = geometry().x();
int y = geometry().y() + height() - 45;
QPoint p(x,y);
diff --git a/src/mainwindow.h b/src/mainwindow.h
index df2c183e..4e32e215 100644
--- a/src/mainwindow.h
+++ b/src/mainwindow.h
@@ -49,21 +49,21 @@ 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
- };
-}
+// 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)
+// };
+// }
/**