summaryrefslogtreecommitdiff
path: root/src/webwindow/rekonqfactory.cpp
diff options
context:
space:
mode:
authorAndrea Diamantini <adjam7@gmail.com>2013-01-14 21:21:20 +0100
committerAndrea Diamantini <adjam7@gmail.com>2013-01-14 21:21:20 +0100
commit2d8de46ae55966ff00e1f89e2133024b5d70edef (patch)
tree53de3b0dfe219cb6d2ca0fa7f35425547d0112c1 /src/webwindow/rekonqfactory.cpp
parentDo NOT clean up urlbar on page errors (diff)
downloadrekonq-2d8de46ae55966ff00e1f89e2133024b5d70edef.tar.xz
Reimplement (in 2.x way) the ability to edit toolbar
BUG: 312340
Diffstat (limited to 'src/webwindow/rekonqfactory.cpp')
-rw-r--r--src/webwindow/rekonqfactory.cpp46
1 files changed, 45 insertions, 1 deletions
diff --git a/src/webwindow/rekonqfactory.cpp b/src/webwindow/rekonqfactory.cpp
index 60ba3872..af15bf42 100644
--- a/src/webwindow/rekonqfactory.cpp
+++ b/src/webwindow/rekonqfactory.cpp
@@ -27,6 +27,7 @@
#include "rekonqfactory.h"
#include "bookmarkstoolbar.h"
+#include "maintoolbar.h"
#include "rekonqmenu.h"
#include <KActionCollection>
@@ -129,7 +130,7 @@ QWidget *RekonqFactory::createWidget(const QString &name, QWidget *parent)
}
else
{
- KToolBar *b = new KToolBar(parent, false , false);
+ MainToolBar *b = new MainToolBar(parent);
fillToolbar(b, node);
return b;
}
@@ -181,8 +182,51 @@ QWidget *RekonqFactory::createWidget(const QString &name, QWidget *parent)
}
+void RekonqFactory::updateWidget(QWidget *widg, const QString &name)
+{
+ QDomDocument document("rekonqui.rc");
+ QString xmlFilePath = KStandardDirs::locate("data", "rekonq/rekonqui.rc");
+
+ if (!readDocument(document, xmlFilePath))
+ return;
+
+ // Toolbars ----------------------------------------------------------------------
+ QDomNodeList elementToolbarList = document.elementsByTagName(QL1S("ToolBar"));
+ if (elementToolbarList.isEmpty())
+ {
+ kDebug() << "ELEMENT TOOLBAR LIST EMPTY. RETURNING NULL";
+ return;
+ }
+
+ for (unsigned int i = 0; i < elementToolbarList.length(); ++i)
+ {
+ QDomNode node = elementToolbarList.at(i);
+ QDomElement element = node.toElement();
+
+ if (element.attribute("name") != name)
+ continue;
+
+ if (element.attribute("deleted").toLower() == "true")
+ {
+ return;
+ }
+
+ if (name == QL1S("mainToolBar"))
+ {
+ fillToolbar(qobject_cast<MainToolBar *>(widg), node);
+ return;
+ }
+ }
+
+ kDebug() << "NO WIDGET RETURNED";
+ return;
+}
+
+
void RekonqFactory::fillToolbar(KToolBar *b, QDomNode node)
{
+ b->clear();
+
QDomElement element = node.toElement();
if (element.hasAttribute("iconSize"))