-rw-r--r-- | noncore/apps/opie-console/BUGS | 3 | ||||
-rw-r--r-- | noncore/apps/opie-console/mainwindow.cpp | 22 |
2 files changed, 22 insertions, 3 deletions
diff --git a/noncore/apps/opie-console/BUGS b/noncore/apps/opie-console/BUGS index 8195dc5..694bc8b 100644 --- a/noncore/apps/opie-console/BUGS +++ b/noncore/apps/opie-console/BUGS | |||
@@ -1,32 +1,35 @@ | |||
1 | Ok we all know we write perfect code | 1 | Ok we all know we write perfect code |
2 | but sometimes the compiler produces bad code | 2 | but sometimes the compiler produces bad code |
3 | and we need to work around some compiler bugs!! -zecke | 3 | and we need to work around some compiler bugs!! -zecke |
4 | 4 | ||
5 | 5 | ||
6 | Send/receive: lrzsz behaves strange when trying to use | 6 | Send/receive: lrzsz behaves strange when trying to use |
7 | --overwrite or --rename. | 7 | --overwrite or --rename. |
8 | 8 | ||
9 | - transfer dialog is still a top dialog instead on the widgetstack of of the | 9 | - transfer dialog is still a top dialog instead on the widgetstack of of the |
10 | connection its used on | 10 | connection its used on |
11 | 11 | ||
12 | - keys and buttonbar merge | 12 | - keys and buttonbar merge |
13 | 13 | ||
14 | - keys really working | 14 | - keys really working |
15 | mc is working | 15 | mc is working |
16 | but F11 on bar seems to be the F10 key and so on | 16 | but F11 on bar seems to be the F10 key and so on |
17 | F9 is F8... -zecke | 17 | F9 is F8... -zecke |
18 | Should be fixed -zecke | 18 | Should be fixed -zecke |
19 | 19 | ||
20 | - scripting with "direct subpopup" | 20 | - scripting with "direct subpopup" |
21 | also: | 21 | also: |
22 | - an indication that it is currently recording, also change menu entry to | 22 | - an indication that it is currently recording, also change menu entry to |
23 | "cancel recording" then | 23 | "cancel recording" then |
24 | 24 | ||
25 | - scripts need an extension and also an icon | 25 | - scripts need an extension and also an icon |
26 | 26 | ||
27 | - help documentation needs to be extended | 27 | - help documentation needs to be extended |
28 | - new connection and save connection | 28 | - new connection and save connection |
29 | - paste button | 29 | - paste button |
30 | - keys button | 30 | - keys button |
31 | 31 | ||
32 | - dial dialog - ugly , better use a qlineedit there to for showing or | ||
33 | disable | ||
34 | |||
32 | - exit / strg + d does not close conection / tab \ No newline at end of file | 35 | - exit / strg + d does not close conection / tab \ No newline at end of file |
diff --git a/noncore/apps/opie-console/mainwindow.cpp b/noncore/apps/opie-console/mainwindow.cpp index c7750be..406586c 100644 --- a/noncore/apps/opie-console/mainwindow.cpp +++ b/noncore/apps/opie-console/mainwindow.cpp | |||
@@ -1,575 +1,591 @@ | |||
1 | #include <assert.h> | 1 | #include <assert.h> |
2 | 2 | ||
3 | #include <qaction.h> | 3 | #include <qaction.h> |
4 | #include <qmenubar.h> | 4 | #include <qmenubar.h> |
5 | #include <qlabel.h> | 5 | #include <qlabel.h> |
6 | #include <qpopupmenu.h> | 6 | #include <qpopupmenu.h> |
7 | #include <qtoolbar.h> | 7 | #include <qtoolbar.h> |
8 | #include <qmessagebox.h> | 8 | #include <qmessagebox.h> |
9 | #include <qpushbutton.h> | 9 | #include <qpushbutton.h> |
10 | #include <qwhatsthis.h> | 10 | #include <qwhatsthis.h> |
11 | 11 | ||
12 | #include <qpe/resource.h> | 12 | #include <qpe/resource.h> |
13 | 13 | ||
14 | #include <opie/ofiledialog.h> | 14 | #include <opie/ofiledialog.h> |
15 | 15 | ||
16 | #include "keytrans.h" | 16 | #include "keytrans.h" |
17 | #include "profileeditordialog.h" | 17 | #include "profileeditordialog.h" |
18 | #include "configdialog.h" | 18 | #include "configdialog.h" |
19 | #include "default.h" | 19 | #include "default.h" |
20 | #include "metafactory.h" | 20 | #include "metafactory.h" |
21 | #include "profile.h" | 21 | #include "profile.h" |
22 | #include "profilemanager.h" | 22 | #include "profilemanager.h" |
23 | #include "mainwindow.h" | 23 | #include "mainwindow.h" |
24 | #include "tabwidget.h" | 24 | #include "tabwidget.h" |
25 | #include "transferdialog.h" | 25 | #include "transferdialog.h" |
26 | #include "function_keyboard.h" | 26 | #include "function_keyboard.h" |
27 | #include "emulation_handler.h" | 27 | #include "emulation_handler.h" |
28 | #include "script.h" | 28 | #include "script.h" |
29 | 29 | ||
30 | 30 | ||
31 | 31 | ||
32 | MainWindow::MainWindow(QWidget *parent, const char *name, WFlags) : QMainWindow(parent, name, WStyle_ContextHelp) { | 32 | MainWindow::MainWindow(QWidget *parent, const char *name, WFlags) : QMainWindow(parent, name, WStyle_ContextHelp) { |
33 | KeyTrans::loadAll(); | 33 | KeyTrans::loadAll(); |
34 | for (int i = 0; i < KeyTrans::count(); i++ ) { | 34 | for (int i = 0; i < KeyTrans::count(); i++ ) { |
35 | KeyTrans* s = KeyTrans::find(i ); | 35 | KeyTrans* s = KeyTrans::find(i ); |
36 | assert( s ); | 36 | assert( s ); |
37 | } | 37 | } |
38 | m_factory = new MetaFactory(); | 38 | m_factory = new MetaFactory(); |
39 | Default def(m_factory); | 39 | Default def(m_factory); |
40 | m_sessions.setAutoDelete( TRUE ); | 40 | m_sessions.setAutoDelete( TRUE ); |
41 | m_curSession = 0; | 41 | m_curSession = 0; |
42 | m_manager = new ProfileManager( m_factory ); | 42 | m_manager = new ProfileManager( m_factory ); |
43 | m_manager->load(); | 43 | m_manager->load(); |
44 | 44 | ||
45 | initUI(); | 45 | initUI(); |
46 | populateProfiles(); | 46 | populateProfiles(); |
47 | } | 47 | } |
48 | void MainWindow::initUI() { | 48 | void MainWindow::initUI() { |
49 | setToolBarsMovable( FALSE ); | 49 | setToolBarsMovable( FALSE ); |
50 | 50 | ||
51 | /* tool bar for the menu */ | 51 | /* tool bar for the menu */ |
52 | m_tool = new QToolBar( this ); | 52 | m_tool = new QToolBar( this ); |
53 | m_tool->setHorizontalStretchable( TRUE ); | 53 | m_tool->setHorizontalStretchable( TRUE ); |
54 | 54 | ||
55 | m_bar = new QMenuBar( m_tool ); | 55 | m_bar = new QMenuBar( m_tool ); |
56 | m_console = new QPopupMenu( this ); | 56 | m_console = new QPopupMenu( this ); |
57 | m_scripts = new QPopupMenu( this ); | 57 | m_scripts = new QPopupMenu( this ); |
58 | m_sessionsPop= new QPopupMenu( this ); | 58 | m_sessionsPop= new QPopupMenu( this ); |
59 | //m_settings = new QPopupMenu( this ); | 59 | //m_settings = new QPopupMenu( this ); |
60 | 60 | ||
61 | /* add a toolbar for icons */ | 61 | /* add a toolbar for icons */ |
62 | m_icons = new QToolBar(this); | 62 | m_icons = new QToolBar(this); |
63 | 63 | ||
64 | 64 | ||
65 | 65 | ||
66 | 66 | ||
67 | /* | 67 | /* |
68 | * the settings action | 68 | * the settings action |
69 | */ | 69 | */ |
70 | m_setProfiles = new QAction(tr("Configure Profiles"), | 70 | m_setProfiles = new QAction(tr("Configure Profiles"), |
71 | Resource::loadPixmap( "SettingsIcon" ), | 71 | Resource::loadPixmap( "SettingsIcon" ), |
72 | QString::null, 0, this, 0); | 72 | QString::null, 0, this, 0); |
73 | // m_setProfiles->addTo( m_settings ); | 73 | // m_setProfiles->addTo( m_settings ); |
74 | m_setProfiles->addTo( m_icons ); | 74 | m_setProfiles->addTo( m_icons ); |
75 | m_setProfiles->addTo( m_console ); | 75 | m_setProfiles->addTo( m_console ); |
76 | connect( m_setProfiles, SIGNAL(activated() ), | 76 | connect( m_setProfiles, SIGNAL(activated() ), |
77 | this, SLOT(slotConfigure() ) ); | 77 | this, SLOT(slotConfigure() ) ); |
78 | 78 | ||
79 | m_console->insertSeparator(); | 79 | m_console->insertSeparator(); |
80 | /* | 80 | /* |
81 | * new Action for new sessions | 81 | * new Action for new sessions |
82 | */ | 82 | */ |
83 | QAction* a = new QAction(tr("New Connection"), | 83 | QAction* a = new QAction(tr("New Connection"), |
84 | Resource::loadPixmap( "new" ), | 84 | Resource::loadPixmap( "new" ), |
85 | QString::null, 0, this, 0); | 85 | QString::null, 0, this, 0); |
86 | a->addTo( m_console ); | 86 | a->addTo( m_console ); |
87 | a->addTo( m_icons ); | 87 | a->addTo( m_icons ); |
88 | connect(a, SIGNAL(activated() ), | 88 | connect(a, SIGNAL(activated() ), |
89 | this, SLOT(slotNew() ) ); | 89 | this, SLOT(slotNew() ) ); |
90 | 90 | ||
91 | m_console->insertSeparator(); | 91 | m_console->insertSeparator(); |
92 | /* save icon is not available */ | 92 | /* save icon is not available */ |
93 | a = new QAction(tr("Save Connection"), | 93 | a = new QAction(tr("Save Connection"), |
94 | Resource::loadPixmap("save"), QString::null, | 94 | Resource::loadPixmap("save"), QString::null, |
95 | 0, this, 0 ); | 95 | 0, this, 0 ); |
96 | a->addTo( m_console ); | 96 | a->addTo( m_console ); |
97 | connect(a, SIGNAL(activated() ), | 97 | connect(a, SIGNAL(activated() ), |
98 | this, SLOT(slotSaveSession() ) ); | 98 | this, SLOT(slotSaveSession() ) ); |
99 | m_console->insertSeparator(); | 99 | m_console->insertSeparator(); |
100 | 100 | ||
101 | /* | 101 | /* |
102 | * connect action | 102 | * connect action |
103 | */ | 103 | */ |
104 | m_connect = new QAction(); | 104 | m_connect = new QAction(); |
105 | m_connect->setText( tr("Connect") ); | 105 | m_connect->setText( tr("Connect") ); |
106 | m_connect->addTo( m_console ); | 106 | m_connect->addTo( m_console ); |
107 | connect(m_connect, SIGNAL(activated() ), | 107 | connect(m_connect, SIGNAL(activated() ), |
108 | this, SLOT(slotConnect() ) ); | 108 | this, SLOT(slotConnect() ) ); |
109 | 109 | ||
110 | /* | 110 | /* |
111 | * disconnect action | 111 | * disconnect action |
112 | */ | 112 | */ |
113 | m_disconnect = new QAction(); | 113 | m_disconnect = new QAction(); |
114 | m_disconnect->setText( tr("Disconnect") ); | 114 | m_disconnect->setText( tr("Disconnect") ); |
115 | m_disconnect->addTo( m_console ); | 115 | m_disconnect->addTo( m_console ); |
116 | connect(m_disconnect, SIGNAL(activated() ), | 116 | connect(m_disconnect, SIGNAL(activated() ), |
117 | this, SLOT(slotDisconnect() ) ); | 117 | this, SLOT(slotDisconnect() ) ); |
118 | 118 | ||
119 | m_console->insertSeparator(); | 119 | m_console->insertSeparator(); |
120 | 120 | ||
121 | m_transfer = new QAction(); | 121 | m_transfer = new QAction(); |
122 | m_transfer->setText( tr("Transfer file...") ); | 122 | m_transfer->setText( tr("Transfer file...") ); |
123 | m_transfer->addTo( m_console ); | 123 | m_transfer->addTo( m_console ); |
124 | connect(m_transfer, SIGNAL(activated() ), | 124 | connect(m_transfer, SIGNAL(activated() ), |
125 | this, SLOT(slotTransfer() ) ); | 125 | this, SLOT(slotTransfer() ) ); |
126 | 126 | ||
127 | 127 | ||
128 | /* | 128 | /* |
129 | * fullscreen | 129 | * fullscreen |
130 | */ | 130 | */ |
131 | m_isFullscreen = false; | 131 | m_isFullscreen = false; |
132 | 132 | ||
133 | m_fullscreen = new QAction( tr("Full screen"), Resource::loadPixmap( "fullscreen" ) | 133 | m_fullscreen = new QAction( tr("Full screen"), Resource::loadPixmap( "fullscreen" ) |
134 | , QString::null, 0, this, 0); | 134 | , QString::null, 0, this, 0); |
135 | m_fullscreen->addTo( m_console ); | 135 | m_fullscreen->addTo( m_console ); |
136 | m_fullscreen->addTo( m_icons ); | 136 | m_fullscreen->addTo( m_icons ); |
137 | connect( m_fullscreen, SIGNAL( activated() ), | 137 | connect( m_fullscreen, SIGNAL( activated() ), |
138 | this, SLOT( slotFullscreen() ) ); | 138 | this, SLOT( slotFullscreen() ) ); |
139 | 139 | ||
140 | m_console->insertSeparator(); | 140 | m_console->insertSeparator(); |
141 | /* | 141 | /* |
142 | * terminate action | 142 | * terminate action |
143 | */ | 143 | */ |
144 | m_terminate = new QAction(); | 144 | m_terminate = new QAction(); |
145 | m_terminate->setText( tr("Terminate") ); | 145 | m_terminate->setText( tr("Terminate") ); |
146 | m_terminate->addTo( m_console ); | 146 | m_terminate->addTo( m_console ); |
147 | connect(m_terminate, SIGNAL(activated() ), | 147 | connect(m_terminate, SIGNAL(activated() ), |
148 | this, SLOT(slotTerminate() ) ); | 148 | this, SLOT(slotTerminate() ) ); |
149 | 149 | ||
150 | m_closewindow = new QAction(); | 150 | m_closewindow = new QAction(); |
151 | m_closewindow->setText( tr("Close Window") ); | 151 | m_closewindow->setText( tr("Close Window") ); |
152 | m_closewindow->addTo( m_console ); | 152 | m_closewindow->addTo( m_console ); |
153 | connect( m_closewindow, SIGNAL(activated() ), | 153 | connect( m_closewindow, SIGNAL(activated() ), |
154 | this, SLOT(slotClose() ) ); | 154 | this, SLOT(slotClose() ) ); |
155 | 155 | ||
156 | 156 | ||
157 | /* | 157 | /* |
158 | * script actions | 158 | * script actions |
159 | */ | 159 | */ |
160 | m_recordScript = new QAction(tr("Record Script"), QString::null, 0, this, 0); | 160 | m_recordScript = new QAction(tr("Record Script"), QString::null, 0, this, 0); |
161 | m_recordScript->addTo(m_scripts); | 161 | m_recordScript->addTo(m_scripts); |
162 | connect(m_recordScript, SIGNAL(activated()), this, SLOT(slotRecordScript())); | 162 | connect(m_recordScript, SIGNAL(activated()), this, SLOT(slotRecordScript())); |
163 | 163 | ||
164 | m_saveScript = new QAction(tr("Save Script"), QString::null, 0, this, 0); | 164 | m_saveScript = new QAction(tr("Save Script"), QString::null, 0, this, 0); |
165 | m_saveScript->addTo(m_scripts); | 165 | m_saveScript->addTo(m_scripts); |
166 | connect(m_saveScript, SIGNAL(activated()), this, SLOT(slotSaveScript())); | 166 | connect(m_saveScript, SIGNAL(activated()), this, SLOT(slotSaveScript())); |
167 | 167 | ||
168 | m_runScript = new QAction(tr("Run Script"), QString::null, 0, this, 0); | 168 | m_runScript = new QAction(tr("Run Script"), QString::null, 0, this, 0); |
169 | m_runScript->addTo(m_scripts); | 169 | m_runScript->addTo(m_scripts); |
170 | connect(m_runScript, SIGNAL(activated()), this, SLOT(slotRunScript())); | 170 | connect(m_runScript, SIGNAL(activated()), this, SLOT(slotRunScript())); |
171 | 171 | ||
172 | /* | 172 | /* |
173 | * action that open/closes the keyboard | 173 | * action that open/closes the keyboard |
174 | */ | 174 | */ |
175 | m_openKeys = new QAction (tr("Open Keyboard..."), | 175 | m_openKeys = new QAction (tr("Open Keyboard..."), |
176 | Resource::loadPixmap( "console/keys/keyboard_icon" ), | 176 | Resource::loadPixmap( "console/keys/keyboard_icon" ), |
177 | QString::null, 0, this, 0); | 177 | QString::null, 0, this, 0); |
178 | 178 | ||
179 | m_openKeys->setToggleAction(true); | 179 | m_openKeys->setToggleAction(true); |
180 | 180 | ||
181 | connect (m_openKeys, SIGNAL(toggled(bool)), | 181 | connect (m_openKeys, SIGNAL(toggled(bool)), |
182 | this, SLOT(slotOpenKeb(bool))); | 182 | this, SLOT(slotOpenKeb(bool))); |
183 | m_openKeys->addTo(m_icons); | 183 | m_openKeys->addTo(m_icons); |
184 | 184 | ||
185 | /* insert the submenu */ | 185 | /* insert the submenu */ |
186 | m_console->insertItem(tr("New from Profile"), m_sessionsPop, | 186 | m_console->insertItem(tr("New from Profile"), m_sessionsPop, |
187 | -1, 0); | 187 | -1, 0); |
188 | 188 | ||
189 | /* insert the connection menu */ | 189 | /* insert the connection menu */ |
190 | m_bar->insertItem( tr("Connection"), m_console ); | 190 | m_bar->insertItem( tr("Connection"), m_console ); |
191 | 191 | ||
192 | /* the scripts menu */ | 192 | /* the scripts menu */ |
193 | m_bar->insertItem( tr("Scripts"), m_scripts ); | 193 | m_bar->insertItem( tr("Scripts"), m_scripts ); |
194 | 194 | ||
195 | /* the settings menu */ | 195 | /* the settings menu */ |
196 | // m_bar->insertItem( tr("Settings"), m_settings ); | 196 | // m_bar->insertItem( tr("Settings"), m_settings ); |
197 | 197 | ||
198 | /* and the keyboard */ | 198 | /* and the keyboard */ |
199 | m_keyBar = new QToolBar(this); | 199 | m_keyBar = new QToolBar(this); |
200 | addToolBar( m_keyBar, "Keyboard", QMainWindow::Top, TRUE ); | 200 | addToolBar( m_keyBar, "Keyboard", QMainWindow::Top, TRUE ); |
201 | m_keyBar->setHorizontalStretchable( TRUE ); | 201 | m_keyBar->setHorizontalStretchable( TRUE ); |
202 | m_keyBar->hide(); | 202 | m_keyBar->hide(); |
203 | 203 | ||
204 | m_kb = new FunctionKeyboard(m_keyBar); | 204 | m_kb = new FunctionKeyboard(m_keyBar); |
205 | connect(m_kb, SIGNAL(keyPressed(FKey, ushort, ushort, bool)), | 205 | connect(m_kb, SIGNAL(keyPressed(FKey, ushort, ushort, bool)), |
206 | this, SLOT(slotKeyReceived(FKey, ushort, ushort, bool))); | 206 | this, SLOT(slotKeyReceived(FKey, ushort, ushort, bool))); |
207 | 207 | ||
208 | m_buttonBar = new QToolBar( this ); | 208 | m_buttonBar = new QToolBar( this ); |
209 | addToolBar( m_buttonBar, "Buttons", QMainWindow::Top, TRUE ); | 209 | addToolBar( m_buttonBar, "Buttons", QMainWindow::Top, TRUE ); |
210 | m_buttonBar->setHorizontalStretchable( TRUE ); | 210 | m_buttonBar->setHorizontalStretchable( TRUE ); |
211 | m_buttonBar->hide(); | 211 | m_buttonBar->hide(); |
212 | 212 | ||
213 | a = new QAction(tr("Copy"), | 213 | a = new QAction(tr("Copy"), |
214 | Resource::loadPixmap("copy"), QString::null, | 214 | Resource::loadPixmap("copy"), QString::null, |
215 | 0, this, 0 ); | 215 | 0, this, 0 ); |
216 | //a->addTo( m_icons ); | 216 | //a->addTo( m_icons ); |
217 | connect( a, SIGNAL(activated() ), | 217 | connect( a, SIGNAL(activated() ), |
218 | this, SLOT(slotCopy() ) ); | 218 | this, SLOT(slotCopy() ) ); |
219 | 219 | ||
220 | a = new QAction(tr("Paste"), | 220 | a = new QAction(tr("Paste"), |
221 | Resource::loadPixmap("paste"), QString::null, | 221 | Resource::loadPixmap("paste"), QString::null, |
222 | 0, this, 0 ); | 222 | 0, this, 0 ); |
223 | a->addTo( m_icons ); | 223 | a->addTo( m_icons ); |
224 | connect( a, SIGNAL(activated() ), | 224 | connect( a, SIGNAL(activated() ), |
225 | this, SLOT(slotPaste() ) ); | 225 | this, SLOT(slotPaste() ) ); |
226 | 226 | ||
227 | 227 | ||
228 | m_connect->setEnabled( false ); | 228 | m_connect->setEnabled( false ); |
229 | m_disconnect->setEnabled( false ); | 229 | m_disconnect->setEnabled( false ); |
230 | m_terminate->setEnabled( false ); | 230 | m_terminate->setEnabled( false ); |
231 | m_transfer->setEnabled( false ); | 231 | m_transfer->setEnabled( false ); |
232 | m_recordScript->setEnabled( false ); | 232 | m_recordScript->setEnabled( false ); |
233 | m_saveScript->setEnabled( false ); | 233 | m_saveScript->setEnabled( false ); |
234 | m_runScript->setEnabled( false ); | 234 | m_runScript->setEnabled( false ); |
235 | m_fullscreen->setEnabled( false ); | 235 | m_fullscreen->setEnabled( false ); |
236 | m_closewindow->setEnabled( false ); | 236 | m_closewindow->setEnabled( false ); |
237 | 237 | ||
238 | /* | 238 | /* |
239 | * connect to the menu activation | 239 | * connect to the menu activation |
240 | */ | 240 | */ |
241 | connect( m_sessionsPop, SIGNAL(activated( int ) ), | 241 | connect( m_sessionsPop, SIGNAL(activated( int ) ), |
242 | this, SLOT(slotProfile( int ) ) ); | 242 | this, SLOT(slotProfile( int ) ) ); |
243 | 243 | ||
244 | m_consoleWindow = new TabWidget( this, "blah"); | 244 | m_consoleWindow = new TabWidget( this, "blah"); |
245 | connect(m_consoleWindow, SIGNAL(activated(Session*) ), | 245 | connect(m_consoleWindow, SIGNAL(activated(Session*) ), |
246 | this, SLOT(slotSessionChanged(Session*) ) ); | 246 | this, SLOT(slotSessionChanged(Session*) ) ); |
247 | setCentralWidget( m_consoleWindow ); | 247 | setCentralWidget( m_consoleWindow ); |
248 | 248 | ||
249 | } | 249 | } |
250 | 250 | ||
251 | ProfileManager* MainWindow::manager() { | 251 | ProfileManager* MainWindow::manager() { |
252 | return m_manager; | 252 | return m_manager; |
253 | } | 253 | } |
254 | TabWidget* MainWindow::tabWidget() { | 254 | TabWidget* MainWindow::tabWidget() { |
255 | return m_consoleWindow; | 255 | return m_consoleWindow; |
256 | } | 256 | } |
257 | void MainWindow::populateProfiles() { | 257 | void MainWindow::populateProfiles() { |
258 | m_sessionsPop->clear(); | 258 | m_sessionsPop->clear(); |
259 | Profile::ValueList list = manager()->all(); | 259 | Profile::ValueList list = manager()->all(); |
260 | for (Profile::ValueList::Iterator it = list.begin(); it != list.end(); ++it ) { | 260 | for (Profile::ValueList::Iterator it = list.begin(); it != list.end(); ++it ) { |
261 | m_sessionsPop->insertItem( (*it).name() ); | 261 | m_sessionsPop->insertItem( (*it).name() ); |
262 | } | 262 | } |
263 | 263 | ||
264 | } | 264 | } |
265 | MainWindow::~MainWindow() { | 265 | MainWindow::~MainWindow() { |
266 | delete m_factory; | 266 | delete m_factory; |
267 | manager()->save(); | 267 | manager()->save(); |
268 | } | 268 | } |
269 | 269 | ||
270 | MetaFactory* MainWindow::factory() { | 270 | MetaFactory* MainWindow::factory() { |
271 | return m_factory; | 271 | return m_factory; |
272 | } | 272 | } |
273 | 273 | ||
274 | Session* MainWindow::currentSession() { | 274 | Session* MainWindow::currentSession() { |
275 | return m_curSession; | 275 | return m_curSession; |
276 | } | 276 | } |
277 | 277 | ||
278 | QList<Session> MainWindow::sessions() { | 278 | QList<Session> MainWindow::sessions() { |
279 | return m_sessions; | 279 | return m_sessions; |
280 | } | 280 | } |
281 | 281 | ||
282 | void MainWindow::slotNew() { | 282 | void MainWindow::slotNew() { |
283 | ProfileEditorDialog dlg(factory() ); | 283 | ProfileEditorDialog dlg(factory() ); |
284 | dlg.showMaximized(); | 284 | dlg.showMaximized(); |
285 | int ret = dlg.exec(); | 285 | int ret = dlg.exec(); |
286 | 286 | ||
287 | if ( ret == QDialog::Accepted ) { | 287 | if ( ret == QDialog::Accepted ) { |
288 | create( dlg.profile() ); | 288 | create( dlg.profile() ); |
289 | } | 289 | } |
290 | } | 290 | } |
291 | 291 | ||
292 | void MainWindow::slotRecordScript() { | 292 | void MainWindow::slotRecordScript() { |
293 | if (currentSession()) { | 293 | if (currentSession()) { |
294 | currentSession()->emulationHandler()->startRecording(); | 294 | currentSession()->emulationHandler()->startRecording(); |
295 | } | 295 | } |
296 | } | 296 | } |
297 | 297 | ||
298 | void MainWindow::slotSaveScript() { | 298 | void MainWindow::slotSaveScript() { |
299 | if (currentSession() && currentSession()->emulationHandler()->isRecording()) { | 299 | if (currentSession() && currentSession()->emulationHandler()->isRecording()) { |
300 | MimeTypes types; | 300 | MimeTypes types; |
301 | QStringList script; | 301 | QStringList script; |
302 | script << "text/plain"; | 302 | script << "text/plain"; |
303 | script << "text/all"; | 303 | script << "text/all"; |
304 | script << "application/octet-stream"; | 304 | script << "application/octet-stream"; |
305 | types.insert("Script", script); | 305 | types.insert("Script", script); |
306 | QString filename = OFileDialog::getSaveFileName(2, "/", QString::null, types); | 306 | QString filename = OFileDialog::getSaveFileName(2, "/", QString::null, types); |
307 | if (!filename.isEmpty()) { | 307 | if (!filename.isEmpty()) { |
308 | currentSession()->emulationHandler()->script()->saveTo(filename); | 308 | currentSession()->emulationHandler()->script()->saveTo(filename); |
309 | currentSession()->emulationHandler()->clearScript(); | 309 | currentSession()->emulationHandler()->clearScript(); |
310 | } | 310 | } |
311 | } | 311 | } |
312 | } | 312 | } |
313 | 313 | ||
314 | void MainWindow::slotRunScript() { | 314 | void MainWindow::slotRunScript() { |
315 | if (currentSession()) { | 315 | if (currentSession()) { |
316 | MimeTypes types; | 316 | MimeTypes types; |
317 | QStringList script; | 317 | QStringList script; |
318 | script << "text/plain"; | 318 | script << "text/plain"; |
319 | script << "text/all"; | 319 | script << "text/all"; |
320 | script << "application/octet-stream"; | 320 | script << "application/octet-stream"; |
321 | types.insert("Script", script); | 321 | types.insert("Script", script); |
322 | QString filename = OFileDialog::getOpenFileName(2, "/", QString::null, types); | 322 | QString filename = OFileDialog::getOpenFileName(2, "/", QString::null, types); |
323 | if (!filename.isEmpty()) { | 323 | if (!filename.isEmpty()) { |
324 | Script script(DocLnk(filename).file()); | 324 | Script script(DocLnk(filename).file()); |
325 | currentSession()->emulationHandler()->runScript(&script); | 325 | currentSession()->emulationHandler()->runScript(&script); |
326 | } | 326 | } |
327 | } | 327 | } |
328 | } | 328 | } |
329 | 329 | ||
330 | void MainWindow::slotConnect() { | 330 | void MainWindow::slotConnect() { |
331 | if ( currentSession() ) { | 331 | if ( currentSession() ) { |
332 | bool ret = currentSession()->layer()->open(); | 332 | bool ret = currentSession()->layer()->open(); |
333 | if(!ret) QMessageBox::warning(currentSession()->widgetStack(), | 333 | if(!ret) QMessageBox::warning(currentSession()->widgetStack(), |
334 | QObject::tr("Failed"), | 334 | QObject::tr("Failed"), |
335 | QObject::tr("Connecting failed for this session.")); | 335 | QObject::tr("Connecting failed for this session.")); |
336 | else { | 336 | else { |
337 | m_connect->setEnabled( false ); | 337 | m_connect->setEnabled( false ); |
338 | m_disconnect->setEnabled( true ); | 338 | m_disconnect->setEnabled( true ); |
339 | m_transfer->setEnabled( true ); | 339 | m_transfer->setEnabled( true ); |
340 | m_recordScript->setEnabled( true ); | ||
341 | m_saveScript->setEnabled( true ); | ||
342 | m_runScript->setEnabled( true ); | ||
340 | } | 343 | } |
341 | } | 344 | } |
342 | } | 345 | } |
343 | 346 | ||
344 | void MainWindow::slotDisconnect() { | 347 | void MainWindow::slotDisconnect() { |
345 | if ( currentSession() ) { | 348 | if ( currentSession() ) { |
346 | currentSession()->layer()->close(); | 349 | currentSession()->layer()->close(); |
347 | m_connect->setEnabled( true ); | 350 | m_connect->setEnabled( true ); |
348 | m_disconnect->setEnabled( false ); | 351 | m_disconnect->setEnabled( false ); |
349 | m_transfer->setEnabled( false ); | 352 | m_transfer->setEnabled( false ); |
353 | m_recordScript->setEnabled( false); | ||
354 | m_saveScript->setEnabled( false ); | ||
355 | m_runScript->setEnabled( false ); | ||
350 | } | 356 | } |
351 | } | 357 | } |
352 | 358 | ||
353 | void MainWindow::slotTerminate() { | 359 | void MainWindow::slotTerminate() { |
354 | if ( currentSession() ) | 360 | if ( currentSession() ) |
355 | currentSession()->layer()->close(); | 361 | currentSession()->layer()->close(); |
356 | 362 | ||
357 | slotClose(); | 363 | slotClose(); |
358 | /* FIXME move to the next session */ | 364 | /* FIXME move to the next session */ |
359 | } | 365 | } |
360 | 366 | ||
361 | void MainWindow::slotConfigure() { | 367 | void MainWindow::slotConfigure() { |
362 | ConfigDialog conf( manager()->all(), factory() ); | 368 | ConfigDialog conf( manager()->all(), factory() ); |
363 | conf.showMaximized(); | 369 | conf.showMaximized(); |
364 | 370 | ||
365 | int ret = conf.exec(); | 371 | int ret = conf.exec(); |
366 | 372 | ||
367 | if ( QDialog::Accepted == ret ) { | 373 | if ( QDialog::Accepted == ret ) { |
368 | manager()->setProfiles( conf.list() ); | 374 | manager()->setProfiles( conf.list() ); |
369 | manager()->save(); | 375 | manager()->save(); |
370 | populateProfiles(); | 376 | populateProfiles(); |
371 | } | 377 | } |
372 | } | 378 | } |
373 | /* | 379 | /* |
374 | * we will remove | 380 | * we will remove |
375 | * this window from the tabwidget | 381 | * this window from the tabwidget |
376 | * remove it from the list | 382 | * remove it from the list |
377 | * delete it | 383 | * delete it |
378 | * and set the currentSession() | 384 | * and set the currentSession() |
379 | */ | 385 | */ |
380 | void MainWindow::slotClose() { | 386 | void MainWindow::slotClose() { |
381 | if (!currentSession() ) | 387 | if (!currentSession() ) |
382 | return; | 388 | return; |
383 | 389 | ||
384 | Session* ses = currentSession(); | 390 | Session* ses = currentSession(); |
385 | qWarning("removing! currentSession %s", currentSession()->name().latin1() ); | 391 | qWarning("removing! currentSession %s", currentSession()->name().latin1() ); |
386 | /* set to NULL to be safe, if its needed slotSessionChanged resets it automatically */ | 392 | /* set to NULL to be safe, if its needed slotSessionChanged resets it automatically */ |
387 | m_curSession = NULL; | 393 | m_curSession = NULL; |
388 | tabWidget()->remove( /*currentSession()*/ses ); | 394 | tabWidget()->remove( /*currentSession()*/ses ); |
389 | /*it's autodelete */ | 395 | /*it's autodelete */ |
390 | m_sessions.remove( ses ); | 396 | m_sessions.remove( ses ); |
391 | qWarning("after remove!!"); | 397 | qWarning("after remove!!"); |
392 | 398 | ||
393 | if (!currentSession() ) { | 399 | if (!currentSession() ) { |
394 | m_connect->setEnabled( false ); | 400 | m_connect->setEnabled( false ); |
395 | m_disconnect->setEnabled( false ); | 401 | m_disconnect->setEnabled( false ); |
396 | m_terminate->setEnabled( false ); | 402 | m_terminate->setEnabled( false ); |
397 | m_transfer->setEnabled( false ); | 403 | m_transfer->setEnabled( false ); |
398 | m_recordScript->setEnabled( false ); | 404 | m_recordScript->setEnabled( false ); |
399 | m_saveScript->setEnabled( false ); | 405 | m_saveScript->setEnabled( false ); |
400 | m_runScript->setEnabled( false ); | 406 | m_runScript->setEnabled( false ); |
401 | m_fullscreen->setEnabled( false ); | 407 | m_fullscreen->setEnabled( false ); |
402 | m_closewindow->setEnabled( false ); | 408 | m_closewindow->setEnabled( false ); |
403 | } | 409 | } |
404 | } | 410 | } |
405 | 411 | ||
406 | /* | 412 | /* |
407 | * We will get the name | 413 | * We will get the name |
408 | * Then the profile | 414 | * Then the profile |
409 | * and then we will make a profile | 415 | * and then we will make a profile |
410 | */ | 416 | */ |
411 | void MainWindow::slotProfile( int id) { | 417 | void MainWindow::slotProfile( int id) { |
412 | Profile prof = manager()->profile( m_sessionsPop->text( id) ); | 418 | Profile prof = manager()->profile( m_sessionsPop->text( id) ); |
413 | create( prof ); | 419 | create( prof ); |
414 | } | 420 | } |
415 | void MainWindow::create( const Profile& prof ) { | 421 | void MainWindow::create( const Profile& prof ) { |
416 | Session *ses = manager()->fromProfile( prof, tabWidget() ); | 422 | Session *ses = manager()->fromProfile( prof, tabWidget() ); |
417 | 423 | ||
418 | if((!ses) || (!ses->layer()) || (!ses->widgetStack())) | 424 | if((!ses) || (!ses->layer()) || (!ses->widgetStack())) |
419 | { | 425 | { |
420 | QMessageBox::warning(this, | 426 | QMessageBox::warning(this, |
421 | QObject::tr("Session failed"), | 427 | QObject::tr("Session failed"), |
422 | QObject::tr("<qt>Cannot open session: Not all components were found.</qt>")); | 428 | QObject::tr("<qt>Cannot open session: Not all components were found.</qt>")); |
423 | //if(ses) delete ses; | 429 | //if(ses) delete ses; |
424 | return; | 430 | return; |
425 | } | 431 | } |
426 | 432 | ||
427 | m_sessions.append( ses ); | 433 | m_sessions.append( ses ); |
428 | tabWidget()->add( ses ); | 434 | tabWidget()->add( ses ); |
429 | tabWidget()->repaint(); | 435 | tabWidget()->repaint(); |
430 | m_curSession = ses; | 436 | m_curSession = ses; |
431 | 437 | ||
432 | // dicide if its a local term ( then no connction and no tranfer), maybe make a wrapper method out of it | 438 | // dicide if its a local term ( then no connction and no tranfer), maybe make a wrapper method out of it |
433 | m_connect->setEnabled( true ); | 439 | m_connect->setEnabled( true ); |
434 | m_disconnect->setEnabled( false ); | 440 | m_disconnect->setEnabled( false ); |
435 | m_terminate->setEnabled( true ); | 441 | m_terminate->setEnabled( true ); |
436 | m_recordScript->setEnabled( true ); | ||
437 | m_saveScript->setEnabled( true ); | ||
438 | m_runScript->setEnabled( true ); | ||
439 | m_fullscreen->setEnabled( true ); | 442 | m_fullscreen->setEnabled( true ); |
440 | m_closewindow->setEnabled( true ); | 443 | m_closewindow->setEnabled( true ); |
441 | m_transfer->setEnabled( false ); | 444 | m_transfer->setEnabled( false ); |
445 | m_recordScript->setEnabled( false ); | ||
446 | m_saveScript->setEnabled( false ); | ||
447 | m_runScript->setEnabled( false ); | ||
442 | 448 | ||
443 | // is io_layer wants direct connection, then autoconnect | 449 | // is io_layer wants direct connection, then autoconnect |
444 | //if ( ( m_curSession->layer() )->supports()[0] == 1 ) { | 450 | //if ( ( m_curSession->layer() )->supports()[0] == 1 ) { |
445 | if (prof.autoConnect()) { | 451 | if (prof.autoConnect()) { |
446 | slotConnect(); | 452 | slotConnect(); |
447 | } | 453 | } |
448 | 454 | ||
449 | 455 | ||
450 | 456 | ||
451 | QWidget *w = currentSession()->widget(); | 457 | QWidget *w = currentSession()->widget(); |
452 | if(w) w->setFocus(); | 458 | if(w) w->setFocus(); |
453 | } | 459 | } |
454 | 460 | ||
455 | void MainWindow::slotTransfer() | 461 | void MainWindow::slotTransfer() |
456 | { | 462 | { |
457 | if ( currentSession() ) { | 463 | if ( currentSession() ) { |
458 | TransferDialog dlg(currentSession()->widgetStack(), this); | 464 | TransferDialog dlg(currentSession()->widgetStack(), this); |
459 | dlg.showMaximized(); | 465 | dlg.showMaximized(); |
460 | //currentSession()->widgetStack()->add(dlg); | 466 | //currentSession()->widgetStack()->add(dlg); |
461 | dlg.exec(); | 467 | dlg.exec(); |
462 | } | 468 | } |
463 | } | 469 | } |
464 | 470 | ||
465 | 471 | ||
466 | void MainWindow::slotOpenKeb(bool state) { | 472 | void MainWindow::slotOpenKeb(bool state) { |
467 | 473 | ||
468 | if (state) m_keyBar->show(); | 474 | if (state) m_keyBar->show(); |
469 | else m_keyBar->hide(); | 475 | else m_keyBar->hide(); |
470 | 476 | ||
471 | } | 477 | } |
472 | 478 | ||
473 | 479 | ||
474 | void MainWindow::slotOpenButtons( bool state ) { | 480 | void MainWindow::slotOpenButtons( bool state ) { |
475 | 481 | ||
476 | if ( state ) { | 482 | if ( state ) { |
477 | m_buttonBar->show(); | 483 | m_buttonBar->show(); |
478 | } else { | 484 | } else { |
479 | m_buttonBar->hide(); | 485 | m_buttonBar->hide(); |
480 | } | 486 | } |
481 | } | 487 | } |
482 | 488 | ||
483 | 489 | ||
484 | 490 | ||
485 | void MainWindow::slotSessionChanged( Session* ses ) { | 491 | void MainWindow::slotSessionChanged( Session* ses ) { |
486 | qWarning("changed!"); | 492 | qWarning("changed!"); |
487 | if ( ses ) { | 493 | if ( ses ) { |
488 | m_curSession = ses; | 494 | m_curSession = ses; |
489 | qDebug(QString("is connected : %1").arg( m_curSession->layer()->isConnected() ) ); | 495 | qDebug(QString("is connected : %1").arg( m_curSession->layer()->isConnected() ) ); |
490 | if ( m_curSession->layer()->isConnected() ) { | 496 | if ( m_curSession->layer()->isConnected() ) { |
491 | m_connect->setEnabled( false ); | 497 | m_connect->setEnabled( false ); |
492 | m_disconnect->setEnabled( true ); | 498 | m_disconnect->setEnabled( true ); |
499 | m_recordScript->setEnabled( true ); | ||
500 | m_saveScript->setEnabled( true ); | ||
501 | m_runScript->setEnabled( true ); | ||
493 | } else { | 502 | } else { |
494 | m_connect->setEnabled( true ); | 503 | m_connect->setEnabled( true ); |
495 | m_disconnect->setEnabled( false ); | 504 | m_disconnect->setEnabled( false ); |
505 | m_recordScript->setEnabled( false ); | ||
506 | m_saveScript->setEnabled( false ); | ||
507 | m_runScript->setEnabled( false ); | ||
496 | } | 508 | } |
497 | 509 | ||
498 | if ( ( m_curSession->layer() )->supports()[1] == 0 ) { | 510 | if ( ( m_curSession->layer() )->supports()[1] == 0 ) { |
499 | m_transfer->setEnabled( false ); | 511 | m_transfer->setEnabled( false ); |
500 | } else { | 512 | } else { |
501 | m_transfer->setEnabled( true ); | 513 | m_transfer->setEnabled( true ); |
502 | } | 514 | } |
503 | 515 | ||
516 | |||
517 | |||
518 | |||
519 | |||
504 | QWidget *w = m_curSession->widget(); | 520 | QWidget *w = m_curSession->widget(); |
505 | if(w) w->setFocus(); | 521 | if(w) w->setFocus(); |
506 | } | 522 | } |
507 | } | 523 | } |
508 | 524 | ||
509 | void MainWindow::slotFullscreen() { | 525 | void MainWindow::slotFullscreen() { |
510 | 526 | ||
511 | 527 | ||
512 | 528 | ||
513 | if ( m_isFullscreen ) { | 529 | if ( m_isFullscreen ) { |
514 | ( m_curSession->widgetStack() )->reparent( savedParentFullscreen, 0, QPoint(0,0), true ); | 530 | ( m_curSession->widgetStack() )->reparent( savedParentFullscreen, 0, QPoint(0,0), true ); |
515 | ( m_curSession->widgetStack() )->resize( savedParentFullscreen->width(), savedParentFullscreen->height() ); | 531 | ( m_curSession->widgetStack() )->resize( savedParentFullscreen->width(), savedParentFullscreen->height() ); |
516 | ( m_curSession->emulationHandler() )->cornerButton()->hide(); | 532 | ( m_curSession->emulationHandler() )->cornerButton()->hide(); |
517 | disconnect( ( m_curSession->emulationHandler() )->cornerButton(), SIGNAL( pressed() ), this, SLOT( slotFullscreen() ) ); | 533 | disconnect( ( m_curSession->emulationHandler() )->cornerButton(), SIGNAL( pressed() ), this, SLOT( slotFullscreen() ) ); |
518 | 534 | ||
519 | } else { | 535 | } else { |
520 | savedParentFullscreen = ( m_curSession->widgetStack() )->parentWidget(); | 536 | savedParentFullscreen = ( m_curSession->widgetStack() )->parentWidget(); |
521 | ( m_curSession->widgetStack() )->setFrameStyle( QFrame::NoFrame ); | 537 | ( m_curSession->widgetStack() )->setFrameStyle( QFrame::NoFrame ); |
522 | ( m_curSession->widgetStack() )->reparent( 0, WStyle_Tool | WStyle_Customize | WStyle_StaysOnTop | 538 | ( m_curSession->widgetStack() )->reparent( 0, WStyle_Tool | WStyle_Customize | WStyle_StaysOnTop |
523 | , QPoint(0,0), false ); | 539 | , QPoint(0,0), false ); |
524 | ( m_curSession->widgetStack() )->resize( qApp->desktop()->width(), qApp->desktop()->height() ); | 540 | ( m_curSession->widgetStack() )->resize( qApp->desktop()->width(), qApp->desktop()->height() ); |
525 | ( m_curSession->widgetStack() )->setFocus(); | 541 | ( m_curSession->widgetStack() )->setFocus(); |
526 | ( m_curSession->widgetStack() )->show(); | 542 | ( m_curSession->widgetStack() )->show(); |
527 | 543 | ||
528 | ( ( m_curSession->emulationHandler() )->cornerButton() )->show(); | 544 | ( ( m_curSession->emulationHandler() )->cornerButton() )->show(); |
529 | 545 | ||
530 | connect( ( m_curSession->emulationHandler() )->cornerButton(), SIGNAL( pressed() ), this, SLOT( slotFullscreen() ) ); | 546 | connect( ( m_curSession->emulationHandler() )->cornerButton(), SIGNAL( pressed() ), this, SLOT( slotFullscreen() ) ); |
531 | } | 547 | } |
532 | 548 | ||
533 | m_isFullscreen = !m_isFullscreen; | 549 | m_isFullscreen = !m_isFullscreen; |
534 | } | 550 | } |
535 | 551 | ||
536 | 552 | ||
537 | void MainWindow::slotKeyReceived(FKey k, ushort, ushort, bool pressed) { | 553 | void MainWindow::slotKeyReceived(FKey k, ushort, ushort, bool pressed) { |
538 | 554 | ||
539 | if ( m_curSession ) { | 555 | if ( m_curSession ) { |
540 | 556 | ||
541 | QEvent::Type state; | 557 | QEvent::Type state; |
542 | 558 | ||
543 | if (pressed) state = QEvent::KeyPress; | 559 | if (pressed) state = QEvent::KeyPress; |
544 | else state = QEvent::KeyRelease; | 560 | else state = QEvent::KeyRelease; |
545 | 561 | ||
546 | QKeyEvent ke(state, k.qcode, k.unicode, 0, QString(QChar(k.unicode))); | 562 | QKeyEvent ke(state, k.qcode, k.unicode, 0, QString(QChar(k.unicode))); |
547 | 563 | ||
548 | // where should i send this event? doesnt work sending it here | 564 | // where should i send this event? doesnt work sending it here |
549 | QApplication::sendEvent((QObject *)m_curSession->widget(), &ke); | 565 | QApplication::sendEvent((QObject *)m_curSession->widget(), &ke); |
550 | ke.ignore(); | 566 | ke.ignore(); |
551 | } | 567 | } |
552 | } | 568 | } |
553 | void MainWindow::slotCopy() { | 569 | void MainWindow::slotCopy() { |
554 | if (!currentSession() ) return; | 570 | if (!currentSession() ) return; |
555 | currentSession()->emulationHandler()->copy(); | 571 | currentSession()->emulationHandler()->copy(); |
556 | } | 572 | } |
557 | void MainWindow::slotPaste() { | 573 | void MainWindow::slotPaste() { |
558 | if (!currentSession() ) return; | 574 | if (!currentSession() ) return; |
559 | currentSession()->emulationHandler()->paste(); | 575 | currentSession()->emulationHandler()->paste(); |
560 | } | 576 | } |
561 | 577 | ||
562 | /* | 578 | /* |
563 | * Save the session | 579 | * Save the session |
564 | */ | 580 | */ |
565 | 581 | ||
566 | void MainWindow::slotSaveSession() { | 582 | void MainWindow::slotSaveSession() { |
567 | if (!currentSession() ) { | 583 | if (!currentSession() ) { |
568 | QMessageBox::information(this, tr("Save Connection"), | 584 | QMessageBox::information(this, tr("Save Connection"), |
569 | tr("<qt>There is no Connection.</qt>"), 1 ); | 585 | tr("<qt>There is no Connection.</qt>"), 1 ); |
570 | return; | 586 | return; |
571 | } | 587 | } |
572 | manager()->add( currentSession()->profile() ); | 588 | manager()->add( currentSession()->profile() ); |
573 | manager()->save(); | 589 | manager()->save(); |
574 | populateProfiles(); | 590 | populateProfiles(); |
575 | } | 591 | } |