[prev in list] [next in list] [prev in thread] [next in thread]
List: kde-commits
Subject: KDE/kdebase/apps/konsole/src [POSSIBLY UNSAFE]
From: Kurt Hindenburg <kurt.hindenburg () gmail ! com>
Date: 2009-04-12 0:27:20
Message-ID: 1239496040.356447.28084.nullmailer () svn ! kde ! org
[Download RAW message or body]
SVN commit 952482 by hindenburg:
Implement org.kde.konsole.Konsole methods (minus activateSession).
Thanks to Arno Töll for the big dbus patch that I'm breaking into smaller pieces.
CCBUG: 169024
M +79 -0 ViewManager.cpp
M +36 -0 ViewManager.h [POSSIBLY UNSAFE: gets]
M +31 -7 org.kde.konsole.Konsole.xml
--- trunk/KDE/kdebase/apps/konsole/src/ViewManager.cpp #952481:952482
@@ -964,5 +964,84 @@
return this->_sessionMap.size();
}
+int ViewManager::currentSession()
+{
+ QHash<TerminalDisplay*,Session*>::iterator i;
+ for (i = this->_sessionMap.begin(); i != this->_sessionMap.end(); ++i)
+ if (i.key()->isVisible())
+ return i.value()->sessionId();
+ return -1;
+}
+
+int ViewManager::newSession()
+{
+ Profile::Ptr profile = profile = SessionManager::instance()->defaultProfile();
+ Session* session = SessionManager::instance()->createSession(profile);
+
+ this->createView(session);
+ session->run();
+
+ return session->sessionId();
+}
+
+int ViewManager::newSession(QString profile, QString directory)
+{
+ QList<Profile::Ptr> profilelist = SessionManager::instance()->loadedProfiles();
+ QList<Profile::Ptr>::iterator i = profilelist.begin();
+
+ Profile::Ptr profileptr = SessionManager::instance()->defaultProfile();
+
+ while (i != profilelist.end() )
+ {
+ Profile::Ptr ptr = *i;
+ if ( ptr->name().compare(profile) == 0)
+ profileptr = ptr;
+ i++;
+ }
+
+ Session* session = SessionManager::instance()->createSession(profileptr);
+ session->setInitialWorkingDirectory(directory);
+
+ this->createView(session);
+ session->run();
+
+ return session->sessionId();
+}
+
+QStringList ViewManager::profileList()
+{
+ QList<Profile::Ptr> profilelist = SessionManager::instance()->loadedProfiles();
+ QList<Profile::Ptr>::iterator i = profilelist.begin();
+ QStringList list;
+ while (i != profilelist.end() )
+ {
+ Profile::Ptr ptr = *i;
+ list.push_back(ptr->name());
+ i++;
+ }
+
+ return list;
+}
+
+void ViewManager::nextSession()
+{
+ this->nextView();
+}
+
+void ViewManager::prevSession()
+{
+ this->previousView();
+}
+
+void ViewManager::moveSessionLeft()
+{
+ this->moveActiveViewLeft();
+}
+
+void ViewManager::moveSessionRight()
+{
+ this->moveActiveViewRight();
+}
+
#include "ViewManager.moc"
--- trunk/KDE/kdebase/apps/konsole/src/ViewManager.h #952481:952482
@@ -206,6 +206,42 @@
/** DBus slot that returns the number of sessions in the current view. */
int sessionCount();
+ /** DBus slot that returns the current (active) session window */
+ int currentSession();
+
+ /** DBus slot that creates a new session in the current view.
+ * @param the name of the profile to be used
+ * @param directory is the working directory, where the session gets
+ * started.
+ */
+ int newSession(QString profile, QString directory);
+
+ // DBus slot that returns a string list of defined (known) profiles
+ QStringList profileList();
+
+ /** DBus slot that creates a new session in the current view with the associated
+ * default profile and the default working directory
+ */
+ int newSession();
+
+ /** DBus slot that changes the view port to the next session */
+ void nextSession();
+
+ /** DBus slot that changes the view port to the previous session */
+ void prevSession();
+
+ /** DBus slot that switches the current session (as returned by
+ * currentSession()) with the left (or previous) one in the
+ * navigation tab.
+ */
+ void moveSessionLeft();
+
+ /** DBus slot that Switches the current session (as returned by
+ * currentSession()) with the right (or next) one in the navigation
+ * tab.
+ */
+ void moveSessionRight();
+
private slots:
// called when the "Split View Left/Right" menu item is selected
void splitLeftRight();
--- trunk/KDE/kdebase/apps/konsole/src/org.kde.konsole.Konsole.xml #952481:952482
@@ -1,9 +1,33 @@
<!DOCTYPE node PUBLIC "-//freedesktop//DTD D-BUS Object Introspection 1.0//EN"
"http://www.freedesktop.org/standards/dbus/1.0/introspect.dtd">
- <node>
- <interface name="org.kde.konsole.Konsole">
- <method name="sessionCount">
- <arg type="i" direction="out"/>
- </method>
- </interface>
- </node>
+<node>
+ <interface name="org.kde.konsole.Konsole">
+ <method name="sessionCount">
+ <arg type="i" direction="out"/>
+ </method>
+ <method name="currentSession">
+ <arg type="i" direction="out"/>
+ </method>
+ <method name="newSession">
+ <arg type="i" direction="out"/>
+ <arg name="profile" type="s" direction="in"/>
+ <arg name="directory" type="s" direction="in"/>
+ </method>
+ <method name="profileList">
+ <arg type="as" direction="out"/>
+ </method>
+ <method name="newSession">
+ <arg type="i" direction="out"/>
+ </method>
+ <method name="nextSession">
+ </method>
+ <method name="prevSession">
+ </method>
+ <method name="moveSessionLeft">
+ </method>
+ <method name="moveSessionRight">
+ </method>
+
+
+ </interface>
+</node>
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic