summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDavid Faure <[email protected]>2017-07-12 10:22:52 +0200
committerDavid Faure <[email protected]>2017-07-12 10:22:52 +0200
commit6e635df985309038cb9feb9753ce753ffe2d3210 (patch)
treea922f65f1e750995a2f9608cd2a5844c0ad4c050
parent295ebd8c120029c0bd230bf2bd514fc525dc52ff (diff)
Add convenience DBus method `qdbus org.kde.konqueror /KonqMain urls`
(so I can find out if I can safely kill konqueror or if I was doing something important with it which I need to finish first ;-)
-rw-r--r--src/KonquerorAdaptor.cpp16
-rw-r--r--src/KonquerorAdaptor.h6
2 files changed, 22 insertions, 0 deletions
diff --git a/src/KonquerorAdaptor.cpp b/src/KonquerorAdaptor.cpp
index eaf3cc9..9d78e4e 100644
--- a/src/KonquerorAdaptor.cpp
+++ b/src/KonquerorAdaptor.cpp
@@ -117,6 +117,22 @@ QList<QDBusObjectPath> KonquerorAdaptor::getWindows()
return lst;
}
+QStringList KonquerorAdaptor::urls() const
+{
+ QStringList lst;
+ QList<KonqMainWindow *> *mainWindows = KonqMainWindow::mainWindowList();
+ if (mainWindows) {
+ for (KonqMainWindow *window : *mainWindows) {
+ if (!window->isPreloaded()) {
+ for (KonqView *view : window->viewMap()) {
+ lst.append(view->url().toString());
+ }
+ }
+ }
+ }
+ return lst;
+}
+
QDBusObjectPath KonquerorAdaptor::windowForTab()
{
QList<KonqMainWindow *> *mainWindows = KonqMainWindow::mainWindowList();
diff --git a/src/KonquerorAdaptor.h b/src/KonquerorAdaptor.h
index 4240932..80b4ccf 100644
--- a/src/KonquerorAdaptor.h
+++ b/src/KonquerorAdaptor.h
@@ -73,6 +73,12 @@ public slots:
QList<QDBusObjectPath> getWindows();
/**
+ * @return a list of all URLs currently opened in this process
+ * Convenience function to avoid iterating over windows by hand.
+ */
+ QStringList urls() const;
+
+ /**
* Find a window which can be used for a new tab. Called by kfmclient.
*/
QDBusObjectPath windowForTab();