-rw-r--r-- | noncore/apps/opie-console/mainwindow.cpp | 6 | ||||
-rw-r--r-- | noncore/apps/opie-console/opie-console.pro | 2 |
2 files changed, 4 insertions, 4 deletions
diff --git a/noncore/apps/opie-console/mainwindow.cpp b/noncore/apps/opie-console/mainwindow.cpp index b3cb208..9b615f1 100644 --- a/noncore/apps/opie-console/mainwindow.cpp +++ b/noncore/apps/opie-console/mainwindow.cpp | |||
@@ -37,391 +37,391 @@ MainWindow::MainWindow(QWidget *parent, const char *name, WFlags) : QMainWindow( | |||
37 | FixIt fix; | 37 | FixIt fix; |
38 | fix.fixIt(); | 38 | fix.fixIt(); |
39 | #endif | 39 | #endif |
40 | 40 | ||
41 | setCaption(QObject::tr("Opie Console") ); | 41 | setCaption(QObject::tr("Opie Console") ); |
42 | KeyTrans::loadAll(); | 42 | KeyTrans::loadAll(); |
43 | for (int i = 0; i < KeyTrans::count(); i++ ) { | 43 | for (int i = 0; i < KeyTrans::count(); i++ ) { |
44 | KeyTrans* s = KeyTrans::find(i ); | 44 | KeyTrans* s = KeyTrans::find(i ); |
45 | assert( s ); | 45 | assert( s ); |
46 | } | 46 | } |
47 | m_factory = new MetaFactory(); | 47 | m_factory = new MetaFactory(); |
48 | Default def(m_factory); | 48 | Default def(m_factory); |
49 | m_sessions.setAutoDelete( TRUE ); | 49 | m_sessions.setAutoDelete( TRUE ); |
50 | m_curSession = 0; | 50 | m_curSession = 0; |
51 | m_manager = new ProfileManager( m_factory ); | 51 | m_manager = new ProfileManager( m_factory ); |
52 | m_manager->load(); | 52 | m_manager->load(); |
53 | m_scriptsData.setAutoDelete(TRUE); | 53 | m_scriptsData.setAutoDelete(TRUE); |
54 | 54 | ||
55 | initUI(); | 55 | initUI(); |
56 | populateProfiles(); | 56 | populateProfiles(); |
57 | populateScripts(); | 57 | populateScripts(); |
58 | } | 58 | } |
59 | 59 | ||
60 | void MainWindow::initUI() { | 60 | void MainWindow::initUI() { |
61 | 61 | ||
62 | setToolBarsMovable( FALSE ); | 62 | setToolBarsMovable( FALSE ); |
63 | 63 | ||
64 | /* tool bar for the menu */ | 64 | /* tool bar for the menu */ |
65 | m_tool = new QToolBar( this ); | 65 | m_tool = new QToolBar( this ); |
66 | m_tool->setHorizontalStretchable( TRUE ); | 66 | m_tool->setHorizontalStretchable( TRUE ); |
67 | 67 | ||
68 | m_bar = new QMenuBar( m_tool ); | 68 | m_bar = new QMenuBar( m_tool ); |
69 | m_console = new QPopupMenu( this ); | 69 | m_console = new QPopupMenu( this ); |
70 | m_scripts = new QPopupMenu( this ); | 70 | m_scripts = new QPopupMenu( this ); |
71 | m_sessionsPop= new QPopupMenu( this ); | 71 | m_sessionsPop= new QPopupMenu( this ); |
72 | m_scriptsPop = new QPopupMenu( this ); | 72 | m_scriptsPop = new QPopupMenu( this ); |
73 | 73 | ||
74 | /* add a toolbar for icons */ | 74 | /* add a toolbar for icons */ |
75 | m_icons = new QToolBar(this); | 75 | m_icons = new QToolBar(this); |
76 | 76 | ||
77 | /* | 77 | /* |
78 | * the settings action | 78 | * the settings action |
79 | */ | 79 | */ |
80 | m_setProfiles = new QAction(tr("Configure Profiles"), | 80 | m_setProfiles = new QAction(tr("Configure Profiles"), |
81 | Resource::loadPixmap( "SettingsIcon" ), | 81 | Resource::loadPixmap( "SettingsIcon" ), |
82 | QString::null, 0, this, 0); | 82 | QString::null, 0, this, 0); |
83 | m_setProfiles->addTo( m_console ); | 83 | m_setProfiles->addTo( m_console ); |
84 | connect( m_setProfiles, SIGNAL(activated() ), | 84 | connect( m_setProfiles, SIGNAL(activated() ), |
85 | this, SLOT(slotConfigure() ) ); | 85 | this, SLOT(slotConfigure() ) ); |
86 | 86 | ||
87 | m_console->insertSeparator(); | 87 | m_console->insertSeparator(); |
88 | /* | 88 | /* |
89 | * new Action for new sessions | 89 | * new Action for new sessions |
90 | */ | 90 | */ |
91 | QAction* newCon = new QAction(tr("New Profile"), | 91 | QAction* newCon = new QAction(tr("New Profile"), |
92 | Resource::loadPixmap( "new" ), | 92 | Resource::loadPixmap( "new" ), |
93 | QString::null, 0, this, 0); | 93 | QString::null, 0, this, 0); |
94 | newCon->addTo( m_console ); | 94 | newCon->addTo( m_console ); |
95 | connect( newCon, SIGNAL(activated() ), | 95 | connect( newCon, SIGNAL(activated() ), |
96 | this, SLOT(slotNew() ) ); | 96 | this, SLOT(slotNew() ) ); |
97 | 97 | ||
98 | m_console->insertSeparator(); | 98 | m_console->insertSeparator(); |
99 | 99 | ||
100 | QAction *saveCon = new QAction( tr("Save Profile" ), | 100 | QAction *saveCon = new QAction( tr("Save Profile" ), |
101 | Resource::loadPixmap( "save" ), QString::null, | 101 | Resource::loadPixmap( "save" ), QString::null, |
102 | 0, this, 0 ); | 102 | 0, this, 0 ); |
103 | saveCon->addTo( m_console ); | 103 | saveCon->addTo( m_console ); |
104 | connect( saveCon, SIGNAL(activated() ), | 104 | connect( saveCon, SIGNAL(activated() ), |
105 | this, SLOT(slotSaveSession() ) ); | 105 | this, SLOT(slotSaveSession() ) ); |
106 | m_console->insertSeparator(); | 106 | m_console->insertSeparator(); |
107 | 107 | ||
108 | /* | 108 | /* |
109 | * connect action | 109 | * connect action |
110 | */ | 110 | */ |
111 | m_connect = new QAction( tr("Connect"), Resource::loadPixmap("console/connected"), | 111 | m_connect = new QAction( tr("Connect"), Resource::loadPixmap("console/connected"), |
112 | QString::null, 0, this, 0 ); | 112 | QString::null, 0, this, 0 ); |
113 | m_connect->addTo( m_console ); | 113 | m_connect->addTo( m_console ); |
114 | connect(m_connect, SIGNAL(activated() ), | 114 | connect(m_connect, SIGNAL(activated() ), |
115 | this, SLOT(slotConnect() ) ); | 115 | this, SLOT(slotConnect() ) ); |
116 | 116 | ||
117 | /* | 117 | /* |
118 | * disconnect action | 118 | * disconnect action |
119 | */ | 119 | */ |
120 | m_disconnect = new QAction( tr("Disconnect"), Resource::loadPixmap("console/notconnected"), | 120 | m_disconnect = new QAction( tr("Disconnect"), Resource::loadPixmap("console/notconnected"), |
121 | QString::null, 0, this, 0 ); | 121 | QString::null, 0, this, 0 ); |
122 | m_disconnect->addTo( m_console ); | 122 | m_disconnect->addTo( m_console ); |
123 | connect(m_disconnect, SIGNAL(activated() ), | 123 | connect(m_disconnect, SIGNAL(activated() ), |
124 | this, SLOT(slotDisconnect() ) ); | 124 | this, SLOT(slotDisconnect() ) ); |
125 | 125 | ||
126 | m_console->insertSeparator(); | 126 | m_console->insertSeparator(); |
127 | 127 | ||
128 | #ifndef EAST | 128 | #ifndef EAST |
129 | m_quickLaunch = new QAction( tr("QuickLaunch"), Resource::loadPixmap("console/konsole_mini"), QString::null, 0, this, 0 ); | 129 | m_quickLaunch = new QAction( tr("QuickLaunch"), Resource::loadPixmap("console/konsole_mini"), QString::null, 0, this, 0 ); |
130 | m_quickLaunch->addTo( m_icons ); | 130 | m_quickLaunch->addTo( m_icons ); |
131 | connect( m_quickLaunch, SIGNAL( activated() ), | 131 | connect( m_quickLaunch, SIGNAL( activated() ), |
132 | this, SLOT( slotQuickLaunch() ) ); | 132 | this, SLOT( slotQuickLaunch() ) ); |
133 | #endif | 133 | #endif |
134 | 134 | ||
135 | QWhatsThis::add( m_icons, tr( "The shell button launches the \"default\" profile. If there is none default values are taken" ) ); | 135 | QWhatsThis::add( m_icons, tr( "The shell button launches the \"default\" profile. If there is none default values are taken" ) ); |
136 | 136 | ||
137 | m_transfer = new QAction( tr("Transfer file..."), Resource::loadPixmap("pass") , QString::null, | 137 | m_transfer = new QAction( tr("Transfer file..."), Resource::loadPixmap("pass") , QString::null, |
138 | 0, this, 0 ); | 138 | 0, this, 0 ); |
139 | m_transfer->addTo( m_console ); | 139 | m_transfer->addTo( m_console ); |
140 | connect(m_transfer, SIGNAL(activated() ), | 140 | connect(m_transfer, SIGNAL(activated() ), |
141 | this, SLOT(slotTransfer() ) ); | 141 | this, SLOT(slotTransfer() ) ); |
142 | 142 | ||
143 | 143 | ||
144 | 144 | ||
145 | /* | 145 | /* |
146 | * immediate change of line wrap policy | 146 | * immediate change of line wrap policy |
147 | */ | 147 | */ |
148 | m_isWrapped = true; | 148 | m_isWrapped = true; |
149 | m_wrap = new QAction( tr("Line wrap"), Resource::loadPixmap( "linewrap" ), QString::null, 0, this, 0, true ); | 149 | m_wrap = new QAction( tr("Line wrap"), Resource::loadPixmap( "linewrap" ), QString::null, 0, this, 0, true ); |
150 | m_wrap->addTo( m_console ); | 150 | m_wrap->addTo( m_console ); |
151 | m_wrap->setOn( true ); | 151 | m_wrap->setOn( true ); |
152 | connect( m_wrap, SIGNAL( activated() ), SLOT( slotWrap() ) ); | 152 | connect( m_wrap, SIGNAL( activated() ), SLOT( slotWrap() ) ); |
153 | 153 | ||
154 | /* | 154 | /* |
155 | * fullscreen | 155 | * fullscreen |
156 | */ | 156 | */ |
157 | m_isFullscreen = false; | 157 | m_isFullscreen = false; |
158 | 158 | ||
159 | m_fullscreen = new QAction( tr("Full screen"), Resource::loadPixmap( "fullscreen" ) | 159 | m_fullscreen = new QAction( tr("Full screen"), Resource::loadPixmap( "fullscreen" ) |
160 | , QString::null, 0, this, 0 ); | 160 | , QString::null, 0, this, 0 ); |
161 | m_fullscreen->addTo( m_console ); | 161 | m_fullscreen->addTo( m_console ); |
162 | connect( m_fullscreen, SIGNAL( activated() ), | 162 | connect( m_fullscreen, SIGNAL( activated() ), |
163 | this, SLOT( slotFullscreen() ) ); | 163 | this, SLOT( slotFullscreen() ) ); |
164 | 164 | ||
165 | m_console->insertSeparator(); | 165 | m_console->insertSeparator(); |
166 | 166 | ||
167 | m_recordLog = new QAction(); | 167 | m_recordLog = new QAction(); |
168 | m_recordLog->setText( tr("Start log") ); | 168 | m_recordLog->setText( tr("Start log") ); |
169 | m_recordLog->addTo( m_console ); | 169 | m_recordLog->addTo( m_console ); |
170 | connect(m_recordLog, SIGNAL(activated() ), | 170 | connect(m_recordLog, SIGNAL(activated() ), |
171 | this, SLOT( slotSaveLog() ) ); | 171 | this, SLOT( slotSaveLog() ) ); |
172 | m_recordingLog = false; | 172 | m_recordingLog = false; |
173 | 173 | ||
174 | QAction *a = new QAction(); | 174 | QAction *a = new QAction(); |
175 | a->setText( tr("Save history") ); | 175 | a->setText( tr("Save history") ); |
176 | a->addTo( m_console ); | 176 | a->addTo( m_console ); |
177 | connect(a, SIGNAL(activated() ), | 177 | connect(a, SIGNAL(activated() ), |
178 | this, SLOT(slotSaveHistory() ) ); | 178 | this, SLOT(slotSaveHistory() ) ); |
179 | /* | 179 | /* |
180 | * terminate action | 180 | * terminate action |
181 | */ | 181 | */ |
182 | m_terminate = new QAction(); | 182 | m_terminate = new QAction(); |
183 | m_terminate->setText( tr("Terminate") ); | 183 | m_terminate->setText( tr("Terminate") ); |
184 | m_terminate->addTo( m_console ); | 184 | m_terminate->addTo( m_console ); |
185 | connect(m_terminate, SIGNAL(activated() ), | 185 | connect(m_terminate, SIGNAL(activated() ), |
186 | this, SLOT(slotTerminate() ) ); | 186 | this, SLOT(slotTerminate() ) ); |
187 | 187 | ||
188 | m_closewindow = new QAction(); | 188 | m_closewindow = new QAction(); |
189 | m_closewindow->setText( tr("Close Window") ); | 189 | m_closewindow->setText( tr("Close Window") ); |
190 | m_closewindow->addTo( m_console ); | 190 | m_closewindow->addTo( m_console ); |
191 | connect( m_closewindow, SIGNAL(activated() ), | 191 | connect( m_closewindow, SIGNAL(activated() ), |
192 | this, SLOT(slotClose() ) ); | 192 | this, SLOT(slotClose() ) ); |
193 | 193 | ||
194 | 194 | ||
195 | /* | 195 | /* |
196 | * script actions | 196 | * script actions |
197 | */ | 197 | */ |
198 | m_runScript_id = m_scripts->insertItem(tr("Run Script"), m_scriptsPop, -1, 0); | 198 | m_runScript_id = m_scripts->insertItem(tr("Run Script"), m_scriptsPop, -1, 0); |
199 | connect(m_scriptsPop, SIGNAL(activated(int)), this, SLOT(slotRunScript(int))); | 199 | connect(m_scriptsPop, SIGNAL(activated(int)), this, SLOT(slotRunScript(int))); |
200 | 200 | ||
201 | m_recordScript = new QAction(tr("Record Script"), QString::null, 0, this, 0); | 201 | m_recordScript = new QAction(tr("Record Script"), QString::null, 0, this, 0); |
202 | m_recordScript->addTo(m_scripts); | 202 | m_recordScript->addTo(m_scripts); |
203 | connect(m_recordScript, SIGNAL(activated()), this, SLOT(slotRecordScript())); | 203 | connect(m_recordScript, SIGNAL(activated()), this, SLOT(slotRecordScript())); |
204 | 204 | ||
205 | m_saveScript = new QAction(tr("Save Script"), QString::null, 0, this, 0); | 205 | m_saveScript = new QAction(tr("Save Script"), QString::null, 0, this, 0); |
206 | m_saveScript->addTo(m_scripts); | 206 | m_saveScript->addTo(m_scripts); |
207 | connect(m_saveScript, SIGNAL(activated()), this, SLOT(slotSaveScript())); | 207 | connect(m_saveScript, SIGNAL(activated()), this, SLOT(slotSaveScript())); |
208 | 208 | ||
209 | 209 | ||
210 | 210 | ||
211 | 211 | ||
212 | /* | 212 | /* |
213 | * action that open/closes the keyboard | 213 | * action that open/closes the keyboard |
214 | */ | 214 | */ |
215 | m_openKeys = new QAction (tr("Open Keyboard..."), | 215 | m_openKeys = new QAction (tr("Open Keyboard..."), |
216 | Resource::loadPixmap( "console/keys/keyboard_icon" ), | 216 | Resource::loadPixmap( "console/keys/keyboard_icon" ), |
217 | QString::null, 0, this, 0); | 217 | QString::null, 0, this, 0); |
218 | m_openKeys->setToggleAction(true); | 218 | m_openKeys->setToggleAction(true); |
219 | connect (m_openKeys, SIGNAL(toggled(bool)), this, SLOT(slotOpenKeb(bool))); | 219 | connect (m_openKeys, SIGNAL(toggled(bool)), this, SLOT(slotOpenKeb(bool))); |
220 | 220 | ||
221 | /* insert the submenu */ | 221 | /* insert the submenu */ |
222 | m_console->insertItem(tr("New from Profile"), m_sessionsPop, | 222 | m_console->insertItem(tr("New from Profile"), m_sessionsPop, |
223 | -1, 0); | 223 | -1, 0); |
224 | 224 | ||
225 | /* insert the connection menu */ | 225 | /* insert the connection menu */ |
226 | m_bar->insertItem( tr("Connection"), m_console ); | 226 | m_bar->insertItem( tr("Connection"), m_console ); |
227 | 227 | ||
228 | /* the scripts menu */ | 228 | /* the scripts menu */ |
229 | #ifdef EAST | 229 | #ifdef EAST |
230 | OConfig cfg("opie-console"); | 230 | Opie::Core::OConfig cfg("opie-console"); |
231 | cfg.setGroup("10east"); | 231 | cfg.setGroup("10east"); |
232 | if( !cfg.readEntry("scripthide",0) ) { | 232 | if( !cfg.readEntry("scripthide",0) ) { |
233 | m_bar->insertItem( tr("Scripts"), m_scripts ); | 233 | m_bar->insertItem( tr("Scripts"), m_scripts ); |
234 | } | 234 | } |
235 | #endif | 235 | #endif |
236 | 236 | ||
237 | /* and the keyboard */ | 237 | /* and the keyboard */ |
238 | m_keyBar = new QToolBar(this); | 238 | m_keyBar = new QToolBar(this); |
239 | addToolBar( m_keyBar, "Keyboard", QMainWindow::Top, TRUE ); | 239 | addToolBar( m_keyBar, "Keyboard", QMainWindow::Top, TRUE ); |
240 | m_keyBar->setHorizontalStretchable( TRUE ); | 240 | m_keyBar->setHorizontalStretchable( TRUE ); |
241 | m_keyBar->hide(); | 241 | m_keyBar->hide(); |
242 | 242 | ||
243 | m_kb = new FunctionKeyboard(m_keyBar); | 243 | m_kb = new FunctionKeyboard(m_keyBar); |
244 | connect(m_kb, SIGNAL(keyPressed(FKey,ushort,ushort,bool)), | 244 | connect(m_kb, SIGNAL(keyPressed(FKey,ushort,ushort,bool)), |
245 | this, SLOT(slotKeyReceived(FKey,ushort,ushort,bool))); | 245 | this, SLOT(slotKeyReceived(FKey,ushort,ushort,bool))); |
246 | 246 | ||
247 | 247 | ||
248 | a = new QAction(tr("Copy"), | 248 | a = new QAction(tr("Copy"), |
249 | Resource::loadPixmap("copy"), QString::null, | 249 | Resource::loadPixmap("copy"), QString::null, |
250 | 0, this, 0 ); | 250 | 0, this, 0 ); |
251 | //a->addTo( m_icons ); | 251 | //a->addTo( m_icons ); |
252 | connect( a, SIGNAL(activated() ), | 252 | connect( a, SIGNAL(activated() ), |
253 | this, SLOT(slotCopy() ) ); | 253 | this, SLOT(slotCopy() ) ); |
254 | 254 | ||
255 | QAction *paste = new QAction(tr("Paste"), | 255 | QAction *paste = new QAction(tr("Paste"), |
256 | Resource::loadPixmap("paste"), QString::null, | 256 | Resource::loadPixmap("paste"), QString::null, |
257 | 0, this, 0 ); | 257 | 0, this, 0 ); |
258 | connect( paste, SIGNAL(activated() ), | 258 | connect( paste, SIGNAL(activated() ), |
259 | this, SLOT(slotPaste() ) ); | 259 | this, SLOT(slotPaste() ) ); |
260 | 260 | ||
261 | 261 | ||
262 | newCon->addTo( m_icons ); | 262 | newCon->addTo( m_icons ); |
263 | //m_setProfiles->addTo( m_icons ); | 263 | //m_setProfiles->addTo( m_icons ); |
264 | paste->addTo( m_icons ); | 264 | paste->addTo( m_icons ); |
265 | m_openKeys->addTo(m_icons); | 265 | m_openKeys->addTo(m_icons); |
266 | m_fullscreen->addTo( m_icons ); | 266 | m_fullscreen->addTo( m_icons ); |
267 | 267 | ||
268 | m_connect->setEnabled( false ); | 268 | m_connect->setEnabled( false ); |
269 | m_disconnect->setEnabled( false ); | 269 | m_disconnect->setEnabled( false ); |
270 | m_terminate->setEnabled( false ); | 270 | m_terminate->setEnabled( false ); |
271 | m_transfer->setEnabled( false ); | 271 | m_transfer->setEnabled( false ); |
272 | m_scripts->setItemEnabled(m_runScript_id, false); | 272 | m_scripts->setItemEnabled(m_runScript_id, false); |
273 | m_recordScript->setEnabled( false ); | 273 | m_recordScript->setEnabled( false ); |
274 | m_saveScript->setEnabled( false ); | 274 | m_saveScript->setEnabled( false ); |
275 | m_fullscreen->setEnabled( false ); | 275 | m_fullscreen->setEnabled( false ); |
276 | m_closewindow->setEnabled( false ); | 276 | m_closewindow->setEnabled( false ); |
277 | m_wrap->setEnabled( false ); | 277 | m_wrap->setEnabled( false ); |
278 | 278 | ||
279 | /* | 279 | /* |
280 | * connect to the menu activation | 280 | * connect to the menu activation |
281 | */ | 281 | */ |
282 | connect( m_sessionsPop, SIGNAL(activated(int) ), | 282 | connect( m_sessionsPop, SIGNAL(activated(int) ), |
283 | this, SLOT(slotProfile(int) ) ); | 283 | this, SLOT(slotProfile(int) ) ); |
284 | 284 | ||
285 | m_consoleWindow = new TabWidget( this, "blah"); | 285 | m_consoleWindow = new TabWidget( this, "blah"); |
286 | connect(m_consoleWindow, SIGNAL(activated(Session*) ), | 286 | connect(m_consoleWindow, SIGNAL(activated(Session*) ), |
287 | this, SLOT(slotSessionChanged(Session*) ) ); | 287 | this, SLOT(slotSessionChanged(Session*) ) ); |
288 | setCentralWidget( m_consoleWindow ); | 288 | setCentralWidget( m_consoleWindow ); |
289 | 289 | ||
290 | slotQuickLaunch(); | 290 | slotQuickLaunch(); |
291 | } | 291 | } |
292 | 292 | ||
293 | ProfileManager* MainWindow::manager() { | 293 | ProfileManager* MainWindow::manager() { |
294 | return m_manager; | 294 | return m_manager; |
295 | } | 295 | } |
296 | TabWidget* MainWindow::tabWidget() { | 296 | TabWidget* MainWindow::tabWidget() { |
297 | return m_consoleWindow; | 297 | return m_consoleWindow; |
298 | } | 298 | } |
299 | void MainWindow::populateProfiles() { | 299 | void MainWindow::populateProfiles() { |
300 | m_sessionsPop->clear(); | 300 | m_sessionsPop->clear(); |
301 | Profile::ValueList list = manager()->all(); | 301 | Profile::ValueList list = manager()->all(); |
302 | for (Profile::ValueList::Iterator it = list.begin(); it != list.end(); ++it ) { | 302 | for (Profile::ValueList::Iterator it = list.begin(); it != list.end(); ++it ) { |
303 | m_sessionsPop->insertItem( (*it).name() ); | 303 | m_sessionsPop->insertItem( (*it).name() ); |
304 | } | 304 | } |
305 | 305 | ||
306 | } | 306 | } |
307 | 307 | ||
308 | void MainWindow::populateScripts() { | 308 | void MainWindow::populateScripts() { |
309 | m_scriptsPop->clear(); | 309 | m_scriptsPop->clear(); |
310 | m_scriptsData.clear(); | 310 | m_scriptsData.clear(); |
311 | DocLnkSet files(QPEApplication::documentDir(), "text/plain"); | 311 | DocLnkSet files(QPEApplication::documentDir(), "text/plain"); |
312 | QListIterator<DocLnk> dit(files.children()); | 312 | QListIterator<DocLnk> dit(files.children()); |
313 | for (; dit.current(); ++dit) { | 313 | for (; dit.current(); ++dit) { |
314 | if (*dit && (*dit)->name().length()>0) { | 314 | if (*dit && (*dit)->name().length()>0) { |
315 | QFileInfo info((*dit)->file()); | 315 | QFileInfo info((*dit)->file()); |
316 | if (info.extension(false) == "script") { | 316 | if (info.extension(false) == "script") { |
317 | m_scriptsData.append(new DocLnk(**dit)); | 317 | m_scriptsData.append(new DocLnk(**dit)); |
318 | m_scriptsPop->insertItem((*dit)->name()); | 318 | m_scriptsPop->insertItem((*dit)->name()); |
319 | } | 319 | } |
320 | } | 320 | } |
321 | } | 321 | } |
322 | 322 | ||
323 | } | 323 | } |
324 | 324 | ||
325 | MainWindow::~MainWindow() { | 325 | MainWindow::~MainWindow() { |
326 | delete m_factory; | 326 | delete m_factory; |
327 | manager()->save(); | 327 | manager()->save(); |
328 | #ifdef FSCKED_DISTRI | 328 | #ifdef FSCKED_DISTRI |
329 | FixIt fix; | 329 | FixIt fix; |
330 | fix.breakIt(); | 330 | fix.breakIt(); |
331 | #endif | 331 | #endif |
332 | } | 332 | } |
333 | 333 | ||
334 | MetaFactory* MainWindow::factory() { | 334 | MetaFactory* MainWindow::factory() { |
335 | return m_factory; | 335 | return m_factory; |
336 | } | 336 | } |
337 | 337 | ||
338 | Session* MainWindow::currentSession() { | 338 | Session* MainWindow::currentSession() { |
339 | return m_curSession; | 339 | return m_curSession; |
340 | } | 340 | } |
341 | 341 | ||
342 | QList<Session> MainWindow::sessions() { | 342 | QList<Session> MainWindow::sessions() { |
343 | return m_sessions; | 343 | return m_sessions; |
344 | } | 344 | } |
345 | 345 | ||
346 | void MainWindow::slotNew() { | 346 | void MainWindow::slotNew() { |
347 | ProfileEditorDialog dlg(factory() ); | 347 | ProfileEditorDialog dlg(factory() ); |
348 | dlg.setCaption( tr("New Connection") ); | 348 | dlg.setCaption( tr("New Connection") ); |
349 | int ret = QPEApplication::execDialog( &dlg ); | 349 | int ret = QPEApplication::execDialog( &dlg ); |
350 | 350 | ||
351 | if ( ret == QDialog::Accepted ) { | 351 | if ( ret == QDialog::Accepted ) { |
352 | create( dlg.profile() ); | 352 | create( dlg.profile() ); |
353 | } | 353 | } |
354 | } | 354 | } |
355 | 355 | ||
356 | void MainWindow::slotRecordScript() { | 356 | void MainWindow::slotRecordScript() { |
357 | if (currentSession()) { | 357 | if (currentSession()) { |
358 | currentSession()->emulationHandler()->startRecording(); | 358 | currentSession()->emulationHandler()->startRecording(); |
359 | m_saveScript->setEnabled(true); | 359 | m_saveScript->setEnabled(true); |
360 | m_recordScript->setEnabled(false); | 360 | m_recordScript->setEnabled(false); |
361 | } | 361 | } |
362 | } | 362 | } |
363 | 363 | ||
364 | void MainWindow::slotSaveScript() { | 364 | void MainWindow::slotSaveScript() { |
365 | if (currentSession() && currentSession()->emulationHandler()->isRecording()) { | 365 | if (currentSession() && currentSession()->emulationHandler()->isRecording()) { |
366 | QMap<QString, QStringList> map; | 366 | QMap<QString, QStringList> map; |
367 | QStringList text; | 367 | QStringList text; |
368 | text << "text/plain"; | 368 | text << "text/plain"; |
369 | map.insert(tr("Script"), text ); | 369 | map.insert(tr("Script"), text ); |
370 | QString filename = OFileDialog::getSaveFileName(2, QPEApplication::documentDir(), QString::null, map); | 370 | QString filename = OFileDialog::getSaveFileName(2, QPEApplication::documentDir(), QString::null, map); |
371 | if (!filename.isEmpty()) { | 371 | if (!filename.isEmpty()) { |
372 | QFileInfo info(filename); | 372 | QFileInfo info(filename); |
373 | if (info.extension(FALSE) != "script") | 373 | if (info.extension(FALSE) != "script") |
374 | filename += ".script"; | 374 | filename += ".script"; |
375 | DocLnk nf; | 375 | DocLnk nf; |
376 | nf.setType("text/plain"); | 376 | nf.setType("text/plain"); |
377 | nf.setFile(filename); | 377 | nf.setFile(filename); |
378 | nf.setName(info.fileName()); | 378 | nf.setName(info.fileName()); |
379 | FileManager fm; | 379 | FileManager fm; |
380 | fm.saveFile(nf, currentSession()->emulationHandler()->script()->script()); | 380 | fm.saveFile(nf, currentSession()->emulationHandler()->script()->script()); |
381 | currentSession()->emulationHandler()->clearScript(); | 381 | currentSession()->emulationHandler()->clearScript(); |
382 | m_saveScript->setEnabled(false); | 382 | m_saveScript->setEnabled(false); |
383 | m_recordScript->setEnabled(true); | 383 | m_recordScript->setEnabled(true); |
384 | populateScripts(); | 384 | populateScripts(); |
385 | } | 385 | } |
386 | } | 386 | } |
387 | } | 387 | } |
388 | 388 | ||
389 | void MainWindow::slotRunScript(int id) { | 389 | void MainWindow::slotRunScript(int id) { |
390 | if (currentSession()) { | 390 | if (currentSession()) { |
391 | int index = m_scriptsPop->indexOf(id); | 391 | int index = m_scriptsPop->indexOf(id); |
392 | DocLnk *lnk = m_scriptsData.at(index); | 392 | DocLnk *lnk = m_scriptsData.at(index); |
393 | QString filePath = lnk->file(); | 393 | QString filePath = lnk->file(); |
394 | Script script(filePath); | 394 | Script script(filePath); |
395 | currentSession()->emulationHandler()->runScript(&script); | 395 | currentSession()->emulationHandler()->runScript(&script); |
396 | } | 396 | } |
397 | } | 397 | } |
398 | 398 | ||
399 | void MainWindow::slotConnect() { | 399 | void MainWindow::slotConnect() { |
400 | if ( currentSession() ) { | 400 | if ( currentSession() ) { |
401 | bool ret = currentSession()->layer()->open(); | 401 | bool ret = currentSession()->layer()->open(); |
402 | if(!ret) QMessageBox::warning(currentSession()->widgetStack(), | 402 | if(!ret) QMessageBox::warning(currentSession()->widgetStack(), |
403 | QObject::tr("Failed"), | 403 | QObject::tr("Failed"), |
404 | QObject::tr("Connecting failed for this session.")); | 404 | QObject::tr("Connecting failed for this session.")); |
405 | else { | 405 | else { |
406 | m_connect->setEnabled( false ); | 406 | m_connect->setEnabled( false ); |
407 | m_disconnect->setEnabled( true ); | 407 | m_disconnect->setEnabled( true ); |
408 | 408 | ||
409 | // if it does not support file transfer, disable the menu entry | 409 | // if it does not support file transfer, disable the menu entry |
410 | if ( ( m_curSession->layer() )->supports()[1] == 0 ) { | 410 | if ( ( m_curSession->layer() )->supports()[1] == 0 ) { |
411 | m_transfer->setEnabled( false ); | 411 | m_transfer->setEnabled( false ); |
412 | } else { | 412 | } else { |
413 | m_transfer->setEnabled( true ); | 413 | m_transfer->setEnabled( true ); |
414 | } | 414 | } |
415 | 415 | ||
416 | m_recordScript->setEnabled( true ); | 416 | m_recordScript->setEnabled( true ); |
417 | m_scripts->setItemEnabled(m_runScript_id, true); | 417 | m_scripts->setItemEnabled(m_runScript_id, true); |
418 | } | 418 | } |
419 | } | 419 | } |
420 | } | 420 | } |
421 | 421 | ||
422 | void MainWindow::slotDisconnect() { | 422 | void MainWindow::slotDisconnect() { |
423 | if ( currentSession() ) { | 423 | if ( currentSession() ) { |
424 | currentSession()->layer()->close(); | 424 | currentSession()->layer()->close(); |
425 | m_connect->setEnabled( true ); | 425 | m_connect->setEnabled( true ); |
426 | m_disconnect->setEnabled( false ); | 426 | m_disconnect->setEnabled( false ); |
427 | m_transfer->setEnabled( false ); | 427 | m_transfer->setEnabled( false ); |
diff --git a/noncore/apps/opie-console/opie-console.pro b/noncore/apps/opie-console/opie-console.pro index a7b9d5f..6db9162 100644 --- a/noncore/apps/opie-console/opie-console.pro +++ b/noncore/apps/opie-console/opie-console.pro | |||
@@ -1,76 +1,76 @@ | |||
1 | TEMPLATE = app | 1 | TEMPLATE = app |
2 | CONFIG += qt warn_on | 2 | CONFIG += qt warn_on |
3 | HEADERS = io_layer.h io_serial.h io_irda.h io_bt.h io_modem.h \ | 3 | HEADERS = io_layer.h io_serial.h io_irda.h io_bt.h io_modem.h \ |
4 | file_layer.h filetransfer.h \ | 4 | file_layer.h filetransfer.h \ |
5 | metafactory.h \ | 5 | metafactory.h \ |
6 | session.h \ | 6 | session.h \ |
7 | mainwindow.h \ | 7 | mainwindow.h \ |
8 | profile.h \ | 8 | profile.h \ |
9 | profileconfig.h \ | 9 | profileconfig.h \ |
10 | profilemanager.h \ | 10 | profilemanager.h \ |
11 | tabwidget.h \ | 11 | tabwidget.h \ |
12 | configdialog.h \ | 12 | configdialog.h \ |
13 | keytrans.h \ | 13 | keytrans.h \ |
14 | transferdialog.h \ | 14 | transferdialog.h \ |
15 | profiledialogwidget.h \ | 15 | profiledialogwidget.h \ |
16 | profileeditordialog.h \ | 16 | profileeditordialog.h \ |
17 | default.h \ | 17 | default.h \ |
18 | iolayerbase.h \ | 18 | iolayerbase.h \ |
19 | serialconfigwidget.h irdaconfigwidget.h \ | 19 | serialconfigwidget.h irdaconfigwidget.h \ |
20 | btconfigwidget.h modemconfigwidget.h \ | 20 | btconfigwidget.h modemconfigwidget.h \ |
21 | atconfigdialog.h dialdialog.h \ | 21 | atconfigdialog.h dialdialog.h \ |
22 | procctl.h \ | 22 | procctl.h \ |
23 | function_keyboard.h \ | 23 | function_keyboard.h \ |
24 | receive_layer.h filereceive.h \ | 24 | receive_layer.h filereceive.h \ |
25 | script.h \ | 25 | script.h \ |
26 | dialer.h logger.h \ | 26 | dialer.h logger.h \ |
27 | terminalwidget.h \ | 27 | terminalwidget.h \ |
28 | emulation_handler.h TECommon.h \ | 28 | emulation_handler.h TECommon.h \ |
29 | TEHistory.h TEScreen.h TEWidget.h \ | 29 | TEHistory.h TEScreen.h TEWidget.h \ |
30 | TEmuVt102.h TEmulation.h MyPty.h \ | 30 | TEmuVt102.h TEmulation.h MyPty.h \ |
31 | consoleconfigwidget.h fixit.h \ | 31 | consoleconfigwidget.h fixit.h \ |
32 | comboboxhelper.h | 32 | comboboxhelper.h |
33 | 33 | ||
34 | SOURCES = io_layer.cpp io_serial.cpp io_irda.cpp io_bt.cpp io_modem.cpp \ | 34 | SOURCES = io_layer.cpp io_serial.cpp io_irda.cpp io_bt.cpp io_modem.cpp \ |
35 | file_layer.cpp filetransfer.cpp \ | 35 | file_layer.cpp filetransfer.cpp \ |
36 | main.cpp \ | 36 | main.cpp \ |
37 | metafactory.cpp \ | 37 | metafactory.cpp \ |
38 | session.cpp \ | 38 | session.cpp \ |
39 | mainwindow.cpp \ | 39 | mainwindow.cpp \ |
40 | profile.cpp \ | 40 | profile.cpp \ |
41 | profileconfig.cpp \ | 41 | profileconfig.cpp \ |
42 | profilemanager.cpp \ | 42 | profilemanager.cpp \ |
43 | tabwidget.cpp \ | 43 | tabwidget.cpp \ |
44 | configdialog.cpp \ | 44 | configdialog.cpp \ |
45 | keytrans.cpp \ | 45 | keytrans.cpp \ |
46 | transferdialog.cpp \ | 46 | transferdialog.cpp \ |
47 | profiledialogwidget.cpp \ | 47 | profiledialogwidget.cpp \ |
48 | profileeditordialog.cpp \ | 48 | profileeditordialog.cpp \ |
49 | iolayerbase.cpp \ | 49 | iolayerbase.cpp \ |
50 | serialconfigwidget.cpp irdaconfigwidget.cpp \ | 50 | serialconfigwidget.cpp irdaconfigwidget.cpp \ |
51 | btconfigwidget.cpp modemconfigwidget.cpp \ | 51 | btconfigwidget.cpp modemconfigwidget.cpp \ |
52 | atconfigdialog.cpp dialdialog.cpp \ | 52 | atconfigdialog.cpp dialdialog.cpp \ |
53 | default.cpp procctl.cpp \ | 53 | default.cpp procctl.cpp \ |
54 | function_keyboard.cpp \ | 54 | function_keyboard.cpp \ |
55 | receive_layer.cpp filereceive.cpp \ | 55 | receive_layer.cpp filereceive.cpp \ |
56 | script.cpp \ | 56 | script.cpp \ |
57 | dialer.cpp logger.cpp \ | 57 | dialer.cpp logger.cpp \ |
58 | terminalwidget.cpp \ | 58 | terminalwidget.cpp \ |
59 | emulation_handler.cpp TEHistory.cpp \ | 59 | emulation_handler.cpp TEHistory.cpp \ |
60 | TEScreen.cpp TEWidget.cpp \ | 60 | TEScreen.cpp TEWidget.cpp \ |
61 | TEmuVt102.cpp TEmulation.cpp MyPty.cpp \ | 61 | TEmuVt102.cpp TEmulation.cpp MyPty.cpp \ |
62 | consoleconfigwidget.cpp fixit.cpp \ | 62 | consoleconfigwidget.cpp fixit.cpp \ |
63 | comboboxhelper.cpp | 63 | comboboxhelper.cpp |
64 | 64 | ||
65 | 65 | ||
66 | DESTDIR = $(OPIEDIR)/bin/ | 66 | DESTDIR = $(OPIEDIR)/bin/ |
67 | INTERFACES = configurebase.ui editbase.ui | 67 | INTERFACES = configurebase.ui editbase.ui |
68 | INCLUDEPATH += $(OPIEDIR)/include | 68 | INCLUDEPATH += $(OPIEDIR)/include |
69 | DEPENDPATH += $(OPIEDIR)/include | 69 | DEPENDPATH += $(OPIEDIR)/include |
70 | LIBS += -lqpe -lopiecore2 -lopieui2 -lutil | 70 | LIBS += -lqpe -lopiecore2 -lopieui2 -lutil |
71 | TARGET = opie-console | 71 | TARGET = opie-console |
72 | 72 | ||
73 | DEFINES += HAVE_OPENPTY | 73 | DEFINES += HAVE_OPENPTY |
74 | DEFINES += EAST FSCKED_DISTRI | 74 | #DEFINES += EAST FSCKED_DISTRI |
75 | 75 | ||
76 | include ( $(OPIEDIR)/include.pro ) | 76 | include ( $(OPIEDIR)/include.pro ) |