[prev in list] [next in list] [prev in thread] [next in thread]
List: kde-commits
Subject: playground/utils/khtml_userscript
From: Mathieu Ducharme <ducharme.mathieu () gmail ! com>
Date: 2007-12-02 1:26:28
Message-ID: 1196558788.705817.13059.nullmailer () svn ! kde ! org
[Download RAW message or body]
SVN commit 743825 by ducharme:
Fix the icon that would be duplicate on every page reload
(This would make for a very crowded statusbar)
This still feels wrong -- if anyone with more skills than I want to take a look, \
please do.
M +15 -16 khtml_userscript.cpp
M +5 -0 khtml_userscript.h
--- trunk/playground/utils/khtml_userscript/khtml_userscript.cpp #743824:743825
@@ -52,6 +52,8 @@
{
kDebug() << "Initiating USERSCRIPT KHtml Plugin...";
+ m_icon = 0;
+
// Get the HTML Part
m_part = dynamic_cast<KHTMLPart *>(parent);
if(!m_part) {
@@ -122,6 +124,8 @@
connect(m_part, SIGNAL(completed()), this, SLOT(slotExecScripts()));
connect(m_part, SIGNAL(completed()), this, SLOT(slotSetStatusbarIcon()));
+ connect(m_part, SIGNAL(started(KIO::Job *)), this, \
SLOT(slotRemoveStatusbarIcon())); +
m_compatIncluded = false;
}
@@ -175,19 +179,6 @@
QVariant res = m_part->executeScript(m_part->htmlDocument(), \
uscript->script()); kDebug() << "Res: " << res;
-/*
- if (comp.complType() == KJS::Throw) {
- kDebug() << "Error in userscript:" << uscript->filename(); \
//todo: print error
- }
- else {
- // Refresh the HTML View so the new script gets painted \
instantly
- // TODO: This does not work. I'm pretty sure it should..?
- kDebug() << "KHTML USERSCRIPT -- Updates are enabled:" << \
m_part->view()->updatesEnabled();
- m_part->view()->repaint();
- m_part->view()->update(); //Asking twice doesn't \
change anything... :)
- m_part->view()->show(); //Asking thrice either
- }
-*/
}
else {
kDebug() << "User Script \"" << uscript->filename() << "\" is \
disabled..."; @@ -197,7 +188,6 @@
}
- //execScripts();
drawMenu();
}
@@ -351,7 +341,7 @@
}
m_icon = new KUrlLabel(m_statusBarEx->statusBar());
-
+
int iconSize = KIconLoader::global()->currentSize(KIconLoader::Small);
m_icon->setFixedHeight(iconSize);
@@ -362,7 +352,6 @@
m_icon->setPixmap(icon.pixmap(iconSize, iconSize, (m_enabled ? QIcon::Normal : \
QIcon::Disabled)));
m_icon->setToolTip(i18n("Konqueror Greasemonkey Userscripts Support"));
-
m_statusBarEx->addStatusBarItem(m_icon, 0, true);
connect(m_icon, SIGNAL(rightClickedUrl()), this, SLOT(slotIconMenu()));
@@ -373,6 +362,16 @@
/*
*
*/
+void KHtmlUserscript::slotRemoveStatusbarIcon()
+{
+ if(m_icon != 0) {
+ m_statusBarEx->removeStatusBarItem(m_icon);
+ }
+}
+
+/*
+*
+*/
void KHtmlUserscript::slotIconMenu()
{
if(!m_menu) {
--- trunk/playground/utils/khtml_userscript/khtml_userscript.h #743824:743825
@@ -164,6 +164,11 @@
* Display the menu on the icon
*/
void slotIconMenu();
+
+ /**
+ * Remove the statusbar icon
+ */
+ void slotRemoveStatusbarIcon();
};
#endif // _KHTML_USERSCRIPT_H_
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic