Changeset View
Changeset View
Standalone View
Standalone View
plugins/konsole/kdevkonsoleview.cpp
Show All 19 Lines | |||||
20 | 20 | | |||
21 | #include <kde_terminal_interface.h> | 21 | #include <kde_terminal_interface.h> | ||
22 | #include <KLocalizedString> | 22 | #include <KLocalizedString> | ||
23 | #include <KPluginFactory> | 23 | #include <KPluginFactory> | ||
24 | #include <KParts/ReadOnlyPart> | 24 | #include <KParts/ReadOnlyPart> | ||
25 | 25 | | |||
26 | #include <interfaces/icore.h> | 26 | #include <interfaces/icore.h> | ||
27 | #include <interfaces/isession.h> | 27 | #include <interfaces/isession.h> | ||
28 | #include <interfaces/idocumentcontroller.h> | ||||
29 | #include <interfaces/iprojectcontroller.h> | ||||
30 | #include <interfaces/iproject.h> | ||||
31 | #include <util/path.h> | ||||
28 | 32 | | |||
29 | #include "kdevkonsoleviewplugin.h" | 33 | #include "kdevkonsoleviewplugin.h" | ||
30 | 34 | | |||
31 | class KDevKonsoleViewPrivate | 35 | class KDevKonsoleViewPrivate | ||
32 | { | 36 | { | ||
33 | public: | 37 | public: | ||
34 | KDevKonsoleViewPlugin* mplugin; | 38 | KDevKonsoleViewPlugin* mplugin; | ||
35 | KDevKonsoleView* m_view; | 39 | KDevKonsoleView* m_view; | ||
Show All 25 Lines | 54 | { | |||
61 | 65 | | |||
62 | m_vbox->addWidget( konsolepart->widget() ); | 66 | m_vbox->addWidget( konsolepart->widget() ); | ||
63 | m_view->setFocusProxy( konsolepart->widget() ); | 67 | m_view->setFocusProxy( konsolepart->widget() ); | ||
64 | konsolepart->widget() ->show(); | 68 | konsolepart->widget() ->show(); | ||
65 | 69 | | |||
66 | TerminalInterface* interface = qobject_cast<TerminalInterface*>(konsolepart); | 70 | TerminalInterface* interface = qobject_cast<TerminalInterface*>(konsolepart); | ||
67 | Q_ASSERT(interface); | 71 | Q_ASSERT(interface); | ||
68 | 72 | | |||
69 | interface->showShellInDir( QString() ); | 73 | QString dir; | ||
74 | if (KDevelop::IDocument* activeDocument = KDevelop::ICore::self()->documentController()->activeDocument()) | ||||
75 | { | ||||
brauch: Hm, does this make sense? I very rarely have sessions with just one project open. Maybe… | |||||
76 | KDevelop::IProject* project = KDevelop::ICore::self()->projectController()->findProjectForUrl(activeDocument->url()); | ||||
77 | if (project && project->path().isLocalFile()) | ||||
78 | dir = project->path().path(); | ||||
79 | else if (activeDocument->url().isLocalFile()) | ||||
80 | dir = activeDocument->url().adjusted(QUrl::RemoveFilename).path(QUrl::FullyDecoded); | ||||
81 | } | ||||
82 | interface->showShellInDir( dir ); | ||||
83 | | ||||
70 | interface->sendInput( " kdevelop! -s \"" + KDevelop::ICore::self()->activeSession()->id().toString() + "\"\n" ); | 84 | interface->sendInput( " kdevelop! -s \"" + KDevelop::ICore::self()->activeSession()->id().toString() + "\"\n" ); | ||
71 | 85 | | |||
72 | }else | 86 | }else | ||
73 | { | 87 | { | ||
74 | qCDebug(PLUGIN_KONSOLE) << "Couldn't create KParts::ReadOnlyPart from konsole factory!"; | 88 | qCDebug(PLUGIN_KONSOLE) << "Couldn't create KParts::ReadOnlyPart from konsole factory!"; | ||
75 | } | 89 | } | ||
76 | } | 90 | } | ||
77 | 91 | | |||
▲ Show 20 Lines • Show All 76 Lines • Show Last 20 Lines |
Hm, does this make sense? I very rarely have sessions with just one project open. Maybe instead use the current document's path or, if you think that is better, the root path of the project in which the current document is?