katesessionpanel.h
00001 /* 00002 This file is part of the TDE project 00003 00004 This library is free software; you can redistribute it and/or 00005 modify it under the terms of the GNU Library General Public 00006 License version 2 as published by the Free Software Foundation. 00007 00008 This library is distributed in the hope that it will be useful, 00009 but WITHOUT ANY WARRANTY; without even the implied warranty of 00010 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 00011 Library General Public License for more details. 00012 00013 You should have received a copy of the GNU Library General Public License 00014 along with this library; see the file COPYING.LIB. If not, write to 00015 the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, 00016 Boston, MA 02110-1301, USA. 00017 */ 00018 00019 #ifndef __KATE_SESSIONPANEL_H__ 00020 #define __KATE_SESSIONPANEL_H__ 00021 00022 /* 00023 The kate session panel displays the available sessions (and their documents) 00024 in a treeview list and allows for quick switching among them. 00025 A toolbar on the top also provides quick access to actions needed 00026 to manage sessions. 00027 */ 00028 00029 #include <tqvbox.h> 00030 #include <tdetoolbar.h> 00031 #include <tdelistview.h> 00032 #include <tqframe.h> 00033 #include <tqlineedit.h> 00034 #include <tqcheckbox.h> 00035 #include <kdialogbase.h> 00036 00037 class KateMainWindow; 00038 class KateViewManager; 00039 class KateSessionManager; 00040 class TDEActionCollection; 00041 00042 00043 //BEGIN KateSessionNameChooser 00044 //FIXME create one single KateSessionNameChooser and reuse it all the time 00045 //FIXME improve string to distinguish between new session and saving an unnamed session 00046 class KateSessionNameChooser : public KDialogBase 00047 { 00048 Q_OBJECT 00049 00050 public: 00051 00052 KateSessionNameChooser(TQWidget *parent, bool showSwitchTo); 00053 ~KateSessionNameChooser() {} 00054 00055 TQString getSessionName(); // return the session name typed by the user 00056 bool getActivateFlag(); // return whether to switch to the new session or not 00057 00058 protected slots: 00059 00060 void slotUser1(); // create new session 00061 void slotUser2(); // cancel 00062 void slotTextChanged(); // session name has changed 00063 00064 protected: 00065 TQLineEdit *m_sessionNameLE; 00066 TQCheckBox *m_activateCB; 00067 bool m_showSwitchTo; // if true, display the m_activateCB checkbox 00068 }; 00069 //BEGIN KateSessionNameChooser 00070 00071 00072 //BEGIN KateSessionPanelToolBarParent 00073 class KateSessionPanelToolBarParent: public TQFrame 00074 { 00075 Q_OBJECT 00076 00077 public: 00078 KateSessionPanelToolBarParent(TQWidget *parent) : TQFrame(parent), m_tbar(0) {} 00079 ~KateSessionPanelToolBarParent() {} 00080 void setToolBar(TDEToolBar *tbar); 00081 00082 protected: 00083 virtual void resizeEvent (TQResizeEvent*); 00084 00085 private: 00086 TDEToolBar *m_tbar; 00087 }; 00088 //END KateSessionPanelToolBarParent 00089 00090 00091 //BEGIN KateSessionPanelItem 00092 class KateSessionPanelItem : public TDEListViewItem 00093 { 00094 public: 00095 KateSessionPanelItem(TQListView *listview, const TQString &sessionName, int sessionId) 00096 : TDEListViewItem(listview, sessionName), m_sessionId(sessionId) {} 00097 KateSessionPanelItem(TQListView *listview, TQListViewItem *after, const TQString &sessionName, int sessionId) 00098 : TDEListViewItem(listview, after, sessionName), m_sessionId(sessionId) {} 00099 00100 int getSessionId() { return m_sessionId; } 00101 void setSessionId(int sessionId) { m_sessionId = sessionId; } 00102 00103 protected: 00104 int m_sessionId; 00105 }; 00106 //END KateSessionPanelItem 00107 00108 00109 //BEGIN KateSessionPanel 00110 class KateSessionPanel : public TQVBox 00111 { 00112 Q_OBJECT 00113 00114 friend class KateMainWindow; 00115 00116 public: 00117 00118 KateSessionPanel(KateMainWindow *mainWindow=0, KateViewManager *viewManager=0, 00119 TQWidget *parent=0, const char *name=0); 00120 ~KateSessionPanel() {} 00121 00122 signals: 00126 void selectionChanged(); 00127 00128 00129 public slots: 00130 void slotNewSession(); 00131 void slotSaveSession(); 00132 void slotSaveSessionAs(); 00133 void slotRenameSession(); 00134 void slotDeleteSession(); 00135 void slotReloadSession(); 00136 void slotActivateSession(); 00137 void slotSessionToggleReadOnly(); 00138 void slotSessionMoveUp(); 00139 void slotSessionMoveDown(); 00140 void slotItemExecuted(TQListViewItem *item); 00141 00142 void slotSelectionChanged(); 00143 void slotSessionActivated(int newSessionId, int oldSessionId); 00144 void slotSessionCreated(int sessionId); 00145 void slotSessionDeleted(int sessionId); 00146 void slotSessionsSwapped(int sessionIdMin, int sessionIdMax); 00147 void slotSessionRenamed(int sessionId); 00148 void slotLVSessionRenamed(TQListViewItem *item); 00149 00150 protected: 00151 void setup_toolbar(); 00152 00153 /* Checks the session switch option. If the choice is 'ask user', 00154 opens a dialog and asks the user what to do. 00155 Returns one of the following: 00156 - KMessageBox::Cancel : the user wants to abort the current operation 00157 - KMessageBox::No : the user wants to discard the session and continue 00158 - KMessageBox::Yes : the user wants to save the session and continue 00159 If the current session is volatile and the session needs to be saved, 00160 it will also ask the user to provide a session name. 00161 */ 00162 int handleSessionSwitch(); 00163 00164 KateSessionManager *m_sessionManager; 00165 TDEActionCollection *m_actionCollection; 00166 TDEToolBar *m_toolbar; 00167 TDEListView *m_listview; 00168 int m_columnName; 00169 int m_columnPixmap; 00170 }; 00171 //END KateSessionPanel 00172 00173 00174 #endif //__KATE_SESSIONPANEL_H__
Trinity API Reference