From kde-commits Sun Apr 12 00:27:20 2009 From: Kurt Hindenburg Date: Sun, 12 Apr 2009 00:27:20 +0000 To: kde-commits Subject: KDE/kdebase/apps/konsole/src [POSSIBLY UNSAFE] Message-Id: <1239496040.356447.28084.nullmailer () svn ! kde ! org> X-MARC-Message: https://marc.info/?l=kde-commits&m=123949604705229 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::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 profilelist = SessionManager::instance()->loadedProfiles(); + QList::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 profilelist = SessionManager::instance()->loadedProfiles(); + QList::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 @@ - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +