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 00113 void openTeletype(int fd); 00114 00115 signals: 00132 void overrideShortcut(QKeyEvent* event, bool& override); 00133 00134 protected: 00136 virtual bool openFile(); 00137 00138 private slots: 00139 // creates a new session using the specified profile. 00140 // call the run() method on the returned Session instance to begin the session 00141 Session* createSession(const Profile::Ptr profile = Profile::Ptr()); 00142 void activeViewChanged(SessionController* controller); 00143 void activeViewTitleChanged(ViewProperties* properties); 00144 void showManageProfilesDialog(); 00145 void terminalExited(); 00146 void newTab(); 00147 void overrideTerminalShortcut(QKeyEvent*,bool& override); 00148 00149 private: 00150 Session* activeSession() const; 00151 void setupActionsForSession(SessionController* session); 00152 void createGlobalActions(); 00153 bool transparencyAvailable(); 00154 00155 private: 00156 ViewManager* _viewManager; 00157 SessionController* _pluggedController; 00158 QAction* _manageProfilesAction; 00159 }; 00160 00161 } 00162 00163 #endif // PART_H