Konsole
Part.h
Go to the documentation of this file.00001 /* 00002 Copyright 2007-2008 by Robert Knight <robertknight@gmail.com> 00003 00004 This program is free software; you can redistribute it and/or modify 00005 it under the terms of the GNU General Public License as published by 00006 the Free Software Foundation; either version 2 of the License, or 00007 (at your option) any later version. 00008 00009 This program is distributed in the hope that it will be useful, 00010 but WITHOUT ANY WARRANTY; without even the implied warranty of 00011 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 00012 GNU General Public License for more details. 00013 00014 You should have received a copy of the GNU General Public License 00015 along with this program; if not, write to the Free Software 00016 Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 00017 02110-1301 USA. 00018 */ 00019 00020 #ifndef PART_H 00021 #define PART_H 00022 00023 // KDE 00024 #include <KParts/Factory> 00025 #include <KParts/Part> 00026 #include <kde_terminal_interface.h> 00027 00028 // Konsole 00029 #include "Profile.h" 00030 00031 class QAction; 00032 class QStringList; 00033 class QKeyEvent; 00034 00035 namespace Konsole 00036 { 00037 class Session; 00038 class SessionController; 00039 class ViewManager; 00040 class ViewProperties; 00041 00045 class PartFactory : public KParts::Factory 00046 { 00047 protected: 00049 virtual KParts::Part* createPartObject(QWidget* parentWidget = 0, 00050 QObject* parent = 0, 00051 const char* classname = "KParts::Part", 00052 const QStringList& args = QStringList()); 00053 }; 00054 00059 class Part : public KParts::ReadOnlyPart , public TerminalInterface 00060 { 00061 Q_OBJECT 00062 Q_INTERFACES(TerminalInterface) 00063 public: 00065 explicit Part(QWidget* parentWidget , QObject* parent = 0); 00066 virtual ~Part(); 00067 00069 virtual void startProgram( const QString& program, 00070 const QStringList& arguments ); 00072 virtual void showShellInDir( const QString& dir ); 00074 virtual void sendInput( const QString& text ); 00075 00076 public slots: 00086 void showManageProfilesDialog(QWidget* parent); 00096 void showEditCurrentProfileDialog(QWidget* parent); 00106 void changeSessionSettings(const QString& text); 00107 00115 void openTeletype(int ptyMasterFd); 00116 00117 signals: 00135 void overrideShortcut(QKeyEvent* event, bool& override); 00136 00137 protected: 00139 virtual bool openFile(); 00140 virtual bool openUrl(const KUrl & url); 00141 00142 private slots: 00143 // creates a new session using the specified profile. 00144 // call the run() method on the returned Session instance to begin the session 00145 Session* createSession(const Profile::Ptr profile = Profile::Ptr()); 00146 void activeViewChanged(SessionController* controller); 00147 void activeViewTitleChanged(ViewProperties* properties); 00148 void showManageProfilesDialog(); 00149 void terminalExited(); 00150 void newTab(); 00151 void overrideTerminalShortcut(QKeyEvent*,bool& override); 00152 00153 private: 00154 Session* activeSession() const; 00155 void setupActionsForSession(SessionController* session); 00156 void createGlobalActions(); 00157 bool transparencyAvailable(); 00158 00159 private: 00160 ViewManager* _viewManager; 00161 SessionController* _pluggedController; 00162 QAction* _manageProfilesAction; 00163 }; 00164 00165 } 00166 00167 #endif // PART_H