summaryrefslogtreecommitdiff
Unidiff
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--core/apps/embeddedkonsole/konsole.cpp14
1 files changed, 7 insertions, 7 deletions
diff --git a/core/apps/embeddedkonsole/konsole.cpp b/core/apps/embeddedkonsole/konsole.cpp
index 3f6e0b4..b0d28fc 100644
--- a/core/apps/embeddedkonsole/konsole.cpp
+++ b/core/apps/embeddedkonsole/konsole.cpp
@@ -61,489 +61,489 @@ public:
61 // Yes, it really is this messy. QTabWidget needs functions 61 // Yes, it really is this messy. QTabWidget needs functions
62 // that provide acces to tabs in a sequential way. 62 // that provide acces to tabs in a sequential way.
63 int m=INT_MIN; 63 int m=INT_MIN;
64 for (int i=0; i<count(); i++) { 64 for (int i=0; i<count(); i++) {
65 QTab* left=0; 65 QTab* left=0;
66 QListIterator<QTab> it(*tabList()); 66 QListIterator<QTab> it(*tabList());
67 int x=INT_MAX; 67 int x=INT_MAX;
68 for( QTab* t; (t=it.current()); ++it ) { 68 for( QTab* t; (t=it.current()); ++it ) {
69 int tx = t->rect().x(); 69 int tx = t->rect().x();
70 if ( tx<x && tx>m ) { 70 if ( tx<x && tx>m ) {
71 x = tx; 71 x = tx;
72 left = t; 72 left = t;
73 } 73 }
74 } 74 }
75 if ( left ) { 75 if ( left ) {
76 left->setText(QString::number(i+1)); 76 left->setText(QString::number(i+1));
77 m = left->rect().x(); 77 m = left->rect().x();
78 } 78 }
79 } 79 }
80 } 80 }
81}; 81};
82 82
83class EKNumTabWidget : public QTabWidget { 83class EKNumTabWidget : public QTabWidget {
84public: 84public:
85 EKNumTabWidget(QWidget* parent) : QTabWidget(parent) 85 EKNumTabWidget(QWidget* parent) : QTabWidget(parent)
86 { 86 {
87 } 87 }
88 88
89 void addTab(QWidget* w) 89 void addTab(QWidget* w)
90 { 90 {
91 QTab* t = new QTab(QString::number(tabBar()->count()+1)); 91 QTab* t = new QTab(QString::number(tabBar()->count()+1));
92 QTabWidget::addTab(w,t); 92 QTabWidget::addTab(w,t);
93 } 93 }
94 94
95 void removeTab(QWidget* w) 95 void removeTab(QWidget* w)
96 { 96 {
97 removePage(w); 97 removePage(w);
98 ((EKNumTabBar*)tabBar())->numberTabs(); 98 ((EKNumTabBar*)tabBar())->numberTabs();
99 } 99 }
100}; 100};
101 101
102// This could be configurable or dynamicly generated from the bash history 102// This could be configurable or dynamicly generated from the bash history
103// file of the user 103// file of the user
104static const char *commonCmds[] = 104static const char *commonCmds[] =
105{ 105{
106 "ls ", // I left this here, cause it looks better than the first alpha 106 "ls ", // I left this here, cause it looks better than the first alpha
107 "cardctl eject", 107 "cardctl eject",
108 "cat ", 108 "cat ",
109 "cd ", 109 "cd ",
110 "chmod ", 110 "chmod ",
111 "clear", 111 "clear",
112 "cp ", 112 "cp ",
113 "dc ", 113 "dc ",
114 "df ", 114 "df ",
115 "dmesg", 115 "dmesg",
116 "echo ", 116 "echo ",
117 "env", 117 "env",
118 "find ", 118 "find ",
119 "free", 119 "free",
120 "grep ", 120 "grep ",
121 "ifconfig ", 121 "ifconfig ",
122 "ipkg ", 122 "ipkg ",
123 "mkdir ", 123 "mkdir ",
124 "mv ", 124 "mv ",
125 "nc localhost 7776", 125 "nc localhost 7776",
126 "nc localhost 7777", 126 "nc localhost 7777",
127 "netstat ", 127 "netstat ",
128 "nslookup ", 128 "nslookup ",
129 "ping ", 129 "ping ",
130 "ps aux", 130 "ps aux",
131 "pwd ", 131 "pwd ",
132 "qcop QPE/System 'linkChanged(QString)' ''", 132 "qcop QPE/System 'linkChanged(QString)' ''",
133 "qcop QPE/System 'restart()'", 133 "qcop QPE/System 'restart()'",
134 "qcop QPE/System 'quit()'", 134 "qcop QPE/System 'quit()'",
135 "rm ", 135 "rm ",
136 "rmdir ", 136 "rmdir ",
137 "route ", 137 "route ",
138 "set ", 138 "set ",
139 "traceroute", 139 "traceroute",
140 140
141/* 141/*
142 "gzip", 142 "gzip",
143 "gunzip", 143 "gunzip",
144 "chgrp", 144 "chgrp",
145 "chown", 145 "chown",
146 "date", 146 "date",
147 "dd", 147 "dd",
148 "df", 148 "df",
149 "dmesg", 149 "dmesg",
150 "fuser", 150 "fuser",
151 "hostname", 151 "hostname",
152 "kill", 152 "kill",
153 "killall", 153 "killall",
154 "ln", 154 "ln",
155 "ping", 155 "ping",
156 "mount", 156 "mount",
157 "more", 157 "more",
158 "sort", 158 "sort",
159 "touch", 159 "touch",
160 "umount", 160 "umount",
161 "mknod", 161 "mknod",
162 "netstat", 162 "netstat",
163*/ 163*/
164 164
165 "exit", 165 "exit",
166 NULL 166 NULL
167}; 167};
168 168
169 169
170Konsole::Konsole(QWidget* parent, const char* name, WFlags fl) : 170Konsole::Konsole(QWidget* parent, const char* name, WFlags fl) :
171 QMainWindow(parent, name, fl) 171 QMainWindow(parent, name, fl)
172{ 172{
173 QStrList args; 173 QStrList args;
174 init("/bin/sh",args); 174 init("/bin/sh",args);
175} 175}
176 176
177Konsole::Konsole(const char* name, const char* _pgm, QStrList & _args, int) 177Konsole::Konsole(const char* name, const char* _pgm, QStrList & _args, int)
178 : QMainWindow(0, name) 178 : QMainWindow(0, name)
179{ 179{
180 init(_pgm,_args); 180 init(_pgm,_args);
181} 181}
182 182
183void Konsole::initCommandList() 183void Konsole::initCommandList()
184{ 184{
185// qDebug("Konsole::initCommandList"); 185// qDebug("Konsole::initCommandList");
186 Config cfg("Konsole"); 186 Config cfg("Konsole");
187 cfg.setGroup("Commands"); 187 cfg.setGroup("Commands");
188 commonCombo->setInsertionPolicy(QComboBox::AtCurrent); 188 commonCombo->setInsertionPolicy(QComboBox::AtCurrent);
189 commonCombo->clear(); 189 commonCombo->clear();
190 if (cfg.readEntry("Commands Set","FALSE") == "FALSE") { 190 if (cfg.readEntry("Commands Set","FALSE") == "FALSE") {
191 for (int i = 0; commonCmds[i] != NULL; i++) { 191 for (int i = 0; commonCmds[i] != NULL; i++) {
192 commonCombo->insertItem(commonCmds[i],i); 192 commonCombo->insertItem(commonCmds[i],i);
193 } 193 }
194 } else { 194 } else {
195 for (int i = 0; i < 100; i++) { 195 for (int i = 0; i < 100; i++) {
196 if (!(cfg.readEntry( QString::number(i),"")).isEmpty()) 196 if (!(cfg.readEntry( QString::number(i),"")).isEmpty())
197 commonCombo->insertItem((cfg.readEntry( QString::number(i),""))); 197 commonCombo->insertItem((cfg.readEntry( QString::number(i),"")));
198 } 198 }
199 } 199 }
200 200
201} 201}
202 202
203void Konsole::init(const char* _pgm, QStrList & _args) 203void Konsole::init(const char* _pgm, QStrList & _args)
204{ 204{
205 b_scroll = TRUE; // histon; 205 b_scroll = TRUE; // histon;
206 n_keytab = 0; 206 n_keytab = 0;
207 n_render = 0; 207 n_render = 0;
208 startUp=0; 208 startUp=0;
209 setCaption( tr("Terminal") ); 209 setCaption( tr("Terminal") );
210 setIcon( Resource::loadPixmap( "konsole" ) ); 210 setIcon( Resource::loadPixmap( "konsole" ) );
211 211
212 Config cfg("Konsole"); 212 Config cfg("Konsole");
213 cfg.setGroup("Konsole"); 213 cfg.setGroup("Konsole");
214 QString tmp; 214 QString tmp;
215 // initialize the list of allowed fonts /////////////////////////////////// 215 // initialize the list of allowed fonts ///////////////////////////////////
216 cfont = cfg.readNumEntry("FontID", 1); 216 cfont = cfg.readNumEntry("FontID", 1);
217 QFont f = QFont("Micro", 4, QFont::Normal); 217 QFont f = QFont("Micro", 4, QFont::Normal);
218 f.setFixedPitch(TRUE); 218 f.setFixedPitch(TRUE);
219 fonts.append(new VTFont(tr("Micro"), f)); 219 fonts.append(new VTFont(tr("Micro"), f));
220 220
221 f = QFont("Fixed", 7, QFont::Normal); 221 f = QFont("Fixed", 7, QFont::Normal);
222 f.setFixedPitch(TRUE); 222 f.setFixedPitch(TRUE);
223 fonts.append(new VTFont(tr("Small Fixed"), f)); 223 fonts.append(new VTFont(tr("Small Fixed"), f));
224 224
225 f = QFont("Fixed", 12, QFont::Normal); 225 f = QFont("Fixed", 12, QFont::Normal);
226 f.setFixedPitch(TRUE); 226 f.setFixedPitch(TRUE);
227 fonts.append(new VTFont(tr("Medium Fixed"), f)); 227 fonts.append(new VTFont(tr("Medium Fixed"), f));
228 228
229 // create terminal emulation framework //////////////////////////////////// 229 // create terminal emulation framework ////////////////////////////////////
230 nsessions = 0; 230 nsessions = 0;
231 231
232 tab = new EKNumTabWidget(this); 232 tab = new EKNumTabWidget(this);
233 233
234 connect(tab, SIGNAL(currentChanged(QWidget*)), this, SLOT(switchSession(QWidget*))); 234 connect(tab, SIGNAL(currentChanged(QWidget*)), this, SLOT(switchSession(QWidget*)));
235 235
236 // create terminal toolbar //////////////////////////////////////////////// 236 // create terminal toolbar ////////////////////////////////////////////////
237 setToolBarsMovable( FALSE ); 237 setToolBarsMovable( FALSE );
238 QPEToolBar *menuToolBar = new QPEToolBar( this ); 238 QPEToolBar *menuToolBar = new QPEToolBar( this );
239 menuToolBar->setHorizontalStretchable( TRUE ); 239 menuToolBar->setHorizontalStretchable( TRUE );
240 240
241 QPEMenuBar *menuBar = new QPEMenuBar( menuToolBar ); 241 QPEMenuBar *menuBar = new QPEMenuBar( menuToolBar );
242 242
243 fontList = new QPopupMenu( this ); 243 fontList = new QPopupMenu( this );
244 for(uint i = 0; i < fonts.count(); i++) { 244 for(uint i = 0; i < fonts.count(); i++) {
245 VTFont *fnt = fonts.at(i); 245 VTFont *fnt = fonts.at(i);
246 fontList->insertItem(fnt->getName(), i); 246 fontList->insertItem(fnt->getName(), i);
247 } 247 }
248 fontChanged(cfont); 248 fontChanged(cfont);
249 249
250 configMenu = new QPopupMenu( this); 250 configMenu = new QPopupMenu( this);
251 colorMenu = new QPopupMenu( this); 251 colorMenu = new QPopupMenu( this);
252 scrollMenu = new QPopupMenu( this); 252 scrollMenu = new QPopupMenu( this);
253 editCommandListMenu = new QPopupMenu( this); 253 editCommandListMenu = new QPopupMenu( this);
254 254
255 configMenu->insertItem("Command List",editCommandListMenu); 255 configMenu->insertItem("Command List",editCommandListMenu);
256 256
257 bool listHidden; 257 bool listHidden;
258 cfg.setGroup("Menubar"); 258 cfg.setGroup("Menubar");
259 if( cfg.readEntry("Hidden","FALSE") == "TRUE") { 259 if( cfg.readEntry("Hidden","FALSE") == "TRUE") {
260 editCommandListMenu->insertItem( tr( "Show command list" )); 260 editCommandListMenu->insertItem( tr( "Show command list" ));
261 listHidden=TRUE; 261 listHidden=TRUE;
262 } else { 262 } else {
263 editCommandListMenu->insertItem( tr( "Hide command list" )); 263 editCommandListMenu->insertItem( tr( "Hide command list" ));
264 listHidden=FALSE; 264 listHidden=FALSE;
265 } 265 }
266 266
267 cfg.setGroup("Tabs"); 267 cfg.setGroup("Tabs");
268 tmp=cfg.readEntry("Position","Bottom"); 268 tmp=cfg.readEntry("Position","Bottom");
269 if(tmp=="Top") { 269 if(tmp=="Top") {
270 tab->setTabPosition(QTabWidget::Top); 270 tab->setTabPosition(QTabWidget::Top);
271 configMenu->insertItem( tr( "Tabs on Bottom" ) ); 271 configMenu->insertItem( tr( "Tabs on Bottom" ) );
272 } else { 272 } else {
273 tab->setTabPosition(QTabWidget::Bottom); 273 tab->setTabPosition(QTabWidget::Bottom);
274 configMenu->insertItem("Tabs on Top"); 274 configMenu->insertItem("Tabs on Top");
275 } 275 }
276 configMenu->insertSeparator(2); 276 configMenu->insertSeparator(2);
277 277
278 colorMenu->insertItem(tr( "Green on Black")); 278 colorMenu->insertItem(tr( "Green on Black"));
279 colorMenu->insertItem(tr( "Black on White")); 279 colorMenu->insertItem(tr( "Black on White"));
280 colorMenu->insertItem(tr( "White on Black")); 280 colorMenu->insertItem(tr( "White on Black"));
281 colorMenu->insertItem(tr( "Black on Transparent")); 281 colorMenu->insertItem(tr( "Black on Transparent"));
282 colorMenu->insertItem(tr( "Black on Red")); 282 colorMenu->insertItem(tr( "Black on Red"));
283 colorMenu->insertItem(tr( "Red on Black")); 283 colorMenu->insertItem(tr( "Red on Black"));
284 colorMenu->insertItem(tr( "Green on Yellow")); 284 colorMenu->insertItem(tr( "Green on Yellow"));
285 colorMenu->insertItem(tr( "Blue on Magenta")); 285 colorMenu->insertItem(tr( "Blue on Magenta"));
286 colorMenu->insertItem(tr( "Magenta on Blue")); 286 colorMenu->insertItem(tr( "Magenta on Blue"));
287 colorMenu->insertItem(tr( "Cyan on White")); 287 colorMenu->insertItem(tr( "Cyan on White"));
288 colorMenu->insertItem(tr( "White on Cyan")); 288 colorMenu->insertItem(tr( "White on Cyan"));
289 colorMenu->insertItem(tr( "Blue on Black")); 289 colorMenu->insertItem(tr( "Blue on Black"));
290 colorMenu->insertItem(tr( "Amber on Black")); 290 colorMenu->insertItem(tr( "Amber on Black"));
291 configMenu->insertItem(tr( "Colors") ,colorMenu); 291 configMenu->insertItem(tr( "Colors") ,colorMenu);
292 292
293 connect( fontList, SIGNAL( activated(int) ), this, SLOT( fontChanged(int) )); 293 connect( fontList, SIGNAL( activated(int) ), this, SLOT( fontChanged(int) ));
294 connect( configMenu, SIGNAL( activated(int) ), this, SLOT( configMenuSelected(int) )); 294 connect( configMenu, SIGNAL( activated(int) ), this, SLOT( configMenuSelected(int) ));
295 connect( colorMenu, SIGNAL( activated(int) ), this, SLOT( colorMenuSelected(int) )); 295 connect( colorMenu, SIGNAL( activated(int) ), this, SLOT( colorMenuSelected(int) ));
296 connect( scrollMenu, SIGNAL(activated(int)),this,SLOT(scrollMenuSelected(int))); 296 connect( scrollMenu, SIGNAL(activated(int)),this,SLOT(scrollMenuSelected(int)));
297 connect(editCommandListMenu,SIGNAL(activated(int)),this,SLOT(editCommandListMenuSelected(int))); 297 connect(editCommandListMenu,SIGNAL(activated(int)),this,SLOT(editCommandListMenuSelected(int)));
298 menuBar->insertItem( tr("Font"), fontList ); 298 menuBar->insertItem( tr("Font"), fontList );
299 menuBar->insertItem( tr("Options"), configMenu ); 299 menuBar->insertItem( tr("Options"), configMenu );
300 300
301 QPEToolBar *toolbar = new QPEToolBar( this ); 301 QPEToolBar *toolbar = new QPEToolBar( this );
302 302
303 QAction *a; 303 QAction *a;
304 304
305 // Button Commands 305 // Button Commands
306 a = new QAction( tr("New"), Resource::loadPixmap( "konsole" ), QString::null, 0, this, 0 ); 306 a = new QAction( tr("New"), Resource::loadPixmap( "konsole" ), QString::null, 0, this, 0 );
307 connect( a, SIGNAL( activated() ), this, SLOT( newSession() ) ); a->addTo( toolbar ); 307 connect( a, SIGNAL( activated() ), this, SLOT( newSession() ) ); a->addTo( toolbar );
308 a = new QAction( tr("Enter"), Resource::loadPixmap( "konsole/enter" ), QString::null, 0, this, 0 ); 308 a = new QAction( tr("Enter"), Resource::loadPixmap( "konsole/enter" ), QString::null, 0, this, 0 );
309 connect( a, SIGNAL( activated() ), this, SLOT( hitEnter() ) ); a->addTo( toolbar ); 309 connect( a, SIGNAL( activated() ), this, SLOT( hitEnter() ) ); a->addTo( toolbar );
310 a = new QAction( tr("Space"), Resource::loadPixmap( "konsole/space" ), QString::null, 0, this, 0 ); 310 a = new QAction( tr("Space"), Resource::loadPixmap( "konsole/space" ), QString::null, 0, this, 0 );
311 connect( a, SIGNAL( activated() ), this, SLOT( hitSpace() ) ); a->addTo( toolbar ); 311 connect( a, SIGNAL( activated() ), this, SLOT( hitSpace() ) ); a->addTo( toolbar );
312 a = new QAction( tr("Tab"), Resource::loadPixmap( "konsole/tab" ), QString::null, 0, this, 0 ); 312 a = new QAction( tr("Tab"), Resource::loadPixmap( "konsole/tab" ), QString::null, 0, this, 0 );
313 connect( a, SIGNAL( activated() ), this, SLOT( hitTab() ) ); a->addTo( toolbar ); 313 connect( a, SIGNAL( activated() ), this, SLOT( hitTab() ) ); a->addTo( toolbar );
314 a = new QAction( tr("Up"), Resource::loadPixmap( "konsole/up" ), QString::null, 0, this, 0 ); 314 a = new QAction( tr("Up"), Resource::loadPixmap( "konsole/up" ), QString::null, 0, this, 0 );
315 connect( a, SIGNAL( activated() ), this, SLOT( hitUp() ) ); a->addTo( toolbar ); 315 connect( a, SIGNAL( activated() ), this, SLOT( hitUp() ) ); a->addTo( toolbar );
316 a = new QAction( tr("Down"), Resource::loadPixmap( "konsole/down" ), QString::null, 0, this, 0 ); 316 a = new QAction( tr("Down"), Resource::loadPixmap( "konsole/down" ), QString::null, 0, this, 0 );
317 connect( a, SIGNAL( activated() ), this, SLOT( hitDown() ) ); a->addTo( toolbar ); 317 connect( a, SIGNAL( activated() ), this, SLOT( hitDown() ) ); a->addTo( toolbar );
318 a = new QAction( tr("Paste"), Resource::loadPixmap( "paste" ), QString::null, 0, this, 0 ); 318 a = new QAction( tr("Paste"), Resource::loadPixmap( "paste" ), QString::null, 0, this, 0 );
319 connect( a, SIGNAL( activated() ), this, SLOT( hitPaste() ) ); a->addTo( toolbar ); 319 connect( a, SIGNAL( activated() ), this, SLOT( hitPaste() ) ); a->addTo( toolbar );
320/* 320/*
321 a = new QAction( tr("Up"), Resource::loadPixmap( "up" ), QString::null, 0, this, 0 ); 321 a = new QAction( tr("Up"), Resource::loadPixmap( "up" ), QString::null, 0, this, 0 );
322 connect( a, SIGNAL( activated() ), this, SLOT( hitUp() ) ); a->addTo( toolbar ); 322 connect( a, SIGNAL( activated() ), this, SLOT( hitUp() ) ); a->addTo( toolbar );
323 a = new QAction( tr("Down"), Resource::loadPixmap( "down" ), QString::null, 0, this, 0 ); 323 a = new QAction( tr("Down"), Resource::loadPixmap( "down" ), QString::null, 0, this, 0 );
324 connect( a, SIGNAL( activated() ), this, SLOT( hitDown() ) ); a->addTo( toolbar ); 324 connect( a, SIGNAL( activated() ), this, SLOT( hitDown() ) ); a->addTo( toolbar );
325*/ 325*/
326 326
327 secondToolBar = new QPEToolBar( this ); 327 secondToolBar = new QPEToolBar( this );
328 secondToolBar->setHorizontalStretchable( TRUE ); 328 secondToolBar->setHorizontalStretchable( TRUE );
329 329
330 commonCombo = new QComboBox( secondToolBar ); 330 commonCombo = new QComboBox( secondToolBar );
331 commonCombo->setMaximumWidth(236); 331 commonCombo->setMaximumWidth(236);
332 332
333 editCommandListMenu->insertItem( tr( "Quick Edit" ) ); 333 editCommandListMenu->insertItem( tr( "Quick Edit" ) );
334 if( listHidden) { 334 if( listHidden) {
335 secondToolBar->hide(); 335 secondToolBar->hide();
336 editCommandListMenu->setItemEnabled(-22 ,FALSE); 336 editCommandListMenu->setItemEnabled(-22 ,FALSE);
337 } 337 }
338 editCommandListMenu->insertItem(tr( "Edit" ) ); 338 editCommandListMenu->insertItem(tr( "Edit" ) );
339 339
340 cfg.setGroup("Commands"); 340 cfg.setGroup("Commands");
341 commonCombo->setInsertionPolicy(QComboBox::AtCurrent); 341 commonCombo->setInsertionPolicy(QComboBox::AtCurrent);
342 342
343 initCommandList(); 343 initCommandList();
344// for (int i = 0; commonCmds[i] != NULL; i++) { 344// for (int i = 0; commonCmds[i] != NULL; i++) {
345// commonCombo->insertItem( commonCmds[i], i ); 345// commonCombo->insertItem( commonCmds[i], i );
346// tmp = cfg.readEntry( QString::number(i),""); 346// tmp = cfg.readEntry( QString::number(i),"");
347// if(tmp != "") 347// if(tmp != "")
348// commonCombo->changeItem( tmp,i ); 348// commonCombo->changeItem( tmp,i );
349// } 349// }
350 350
351 connect( commonCombo, SIGNAL( activated(int) ), this, SLOT( enterCommand(int) )); 351 connect( commonCombo, SIGNAL( activated(int) ), this, SLOT( enterCommand(int) ));
352 352
353 scrollMenu->insertItem(tr( "None" )); 353 scrollMenu->insertItem(tr( "None" ));
354 scrollMenu->insertItem(tr( "Left" )); 354 scrollMenu->insertItem(tr( "Left" ));
355 scrollMenu->insertItem(tr( "Right" )); 355 scrollMenu->insertItem(tr( "Right" ));
356 configMenu->insertItem(tr( "ScrollBar" ),scrollMenu); 356 configMenu->insertItem(tr( "ScrollBar" ),scrollMenu);
357 357
358 // create applications ///////////////////////////////////////////////////// 358 // create applications /////////////////////////////////////////////////////
359 setCentralWidget(tab); 359 setCentralWidget(tab);
360 360
361 // load keymaps //////////////////////////////////////////////////////////// 361 // load keymaps ////////////////////////////////////////////////////////////
362 KeyTrans::loadAll(); 362 KeyTrans::loadAll();
363 for (int i = 0; i < KeyTrans::count(); i++) 363 for (int i = 0; i < KeyTrans::count(); i++)
364 { KeyTrans* s = KeyTrans::find(i); 364 { KeyTrans* s = KeyTrans::find(i);
365 assert( s ); 365 assert( s );
366 } 366 }
367 367
368 se_pgm = _pgm; 368 se_pgm = _pgm;
369 se_args = _args; 369 se_args = _args;
370 370
371parseCommandLine(); 371parseCommandLine();
372 // read and apply default values /////////////////////////////////////////// 372 // read and apply default values ///////////////////////////////////////////
373 resize(321, 321); // Dummy. 373 resize(321, 321); // Dummy.
374 QSize currentSize = size(); 374 QSize currentSize = size();
375 if (currentSize != size()) 375 if (currentSize != size())
376 defaultSize = size(); 376 defaultSize = size();
377} 377}
378 378
379void Konsole::show() 379void Konsole::show()
380{ 380{
381 if ( !nsessions ) { 381 if ( !nsessions ) {
382 newSession(); 382 newSession();
383 } 383 }
384 QMainWindow::show(); 384 QMainWindow::show();
385} 385}
386 386
387void Konsole::initSession(const char*, QStrList &) 387void Konsole::initSession(const char*, QStrList &)
388{ 388{
389 QMainWindow::show(); 389 QMainWindow::show();
390} 390}
391 391
392Konsole::~Konsole() 392Konsole::~Konsole()
393{ 393{
394 while (nsessions > 0) { 394 while (nsessions > 0) {
395 doneSession(getTe()->currentSession, 0); 395 doneSession(getTe()->currentSession, 0);
396 } 396 }
397 397
398 Config cfg("Konsole"); 398 Config cfg("Konsole");
399 cfg.setGroup("Konsole"); 399 cfg.setGroup("Konsole");
400 cfg.writeEntry("FontID", cfont); 400 cfg.writeEntry("FontID", cfont);
401} 401}
402 402
403void Konsole::fontChanged(int f) 403void Konsole::fontChanged(int f)
404{ 404{
405 VTFont* font = fonts.at(f); 405 VTFont* font = fonts.at(f);
406 if (font != 0) { 406 if (font != 0) {
407 for(uint i = 0; i < fonts.count(); i++) { 407 for(uint i = 0; i < fonts.count(); i++) {
408 fontList->setItemChecked(i, (i == (uint) f) ? TRUE : FALSE); 408 fontList->setItemChecked(i, (i == (uint) f) ? TRUE : FALSE);
409 } 409 }
410 410
411 cfont = f; 411 cfont = f;
412 412
413 TEWidget* te = getTe(); 413 TEWidget* te = getTe();
414 if (te != 0) { 414 if (te != 0) {
415 te->setVTFont(font->getFont()); 415 te->setVTFont(font->getFont());
416 } 416 }
417 } 417 }
418} 418}
419 419
420 420
421void Konsole::enterCommand(int c) 421void Konsole::enterCommand(int c)
422{ 422{
423 TEWidget* te = getTe(); 423 TEWidget* te = getTe();
424 if (te != 0) { 424 if (te != 0) {
425 if(!commonCombo->editable()) { 425 if(!commonCombo->editable()) {
426 QString text = commonCombo->text(c); //commonCmds[c]; 426 QString text = commonCombo->text(c); //commonCmds[c];
427 te->emitText(text); 427 te->emitText(text);
428 } else { 428 } else {
429 changeCommand( commonCombo->text(c), c); 429 changeCommand( commonCombo->text(c), c);
430 } 430 }
431 } 431 }
432} 432}
433 433
434void Konsole::hitEnter() 434void Konsole::hitEnter()
435{ 435{
436 TEWidget* te = getTe(); 436 TEWidget* te = getTe();
437 if (te != 0) { 437 if (te != 0) {
438 te->emitText(QString("\r")); 438 te->emitText(QString("\r"));
439 } 439 }
440} 440}
441 441
442void Konsole::hitSpace() 442void Konsole::hitSpace()
443{ 443{
444 TEWidget* te = getTe(); 444 TEWidget* te = getTe();
445 if (te != 0) { 445 if (te != 0) {
446 te->emitText(QString(" ")); 446 te->emitText(QString(" "));
447 } 447 }
448} 448}
449 449
450void Konsole::hitTab() 450void Konsole::hitTab()
451{ 451{
452 TEWidget* te = getTe(); 452 TEWidget* te = getTe();
453 if (te != 0) { 453 if (te != 0) {
454 te->emitText(QString("\t")); 454 te->emitText(QString("\t"));
455 } 455 }
456} 456}
457 457
458void Konsole::hitPaste() 458void Konsole::hitPaste()
459{ 459{
460 TEWidget* te = getTe(); 460 TEWidget* te = getTe();
461 if (te != 0) { 461 if (te != 0) {
462 te->pasteClipboard(); 462 te->pasteClipboard();
463 } 463 }
464} 464}
465 465
466void Konsole::hitUp() 466void Konsole::hitUp()
467{ 467{
468 TEWidget* te = getTe(); 468 TEWidget* te = getTe();
469 if (te != 0) { 469 if (te != 0) {
470 QKeyEvent ke( QKeyEvent::KeyPress, Qt::Key_Up, 0, 0); 470 QKeyEvent ke( QKeyEvent::KeyPress, Qt::Key_Up, 0, 0);
471 QApplication::sendEvent( te, &ke ); 471 QApplication::sendEvent( te, &ke );
472 } 472 }
473} 473}
474 474
475void Konsole::hitDown() 475void Konsole::hitDown()
476{ 476{
477 TEWidget* te = getTe(); 477 TEWidget* te = getTe();
478 if (te != 0) { 478 if (te != 0) {
479 QKeyEvent ke( QKeyEvent::KeyPress, Qt::Key_Down, 0, 0); 479 QKeyEvent ke( QKeyEvent::KeyPress, Qt::Key_Down, 0, 0);
480 QApplication::sendEvent( te, &ke ); 480 QApplication::sendEvent( te, &ke );
481 } 481 }
482} 482}
483 483
484/** 484/**
485 This function calculates the size of the external widget 485 This function calculates the size of the external widget
486 needed for the internal widget to be 486 needed for the internal widget to be
487 */ 487 */
488QSize Konsole::calcSize(int columns, int lines) { 488QSize Konsole::calcSize(int columns, int lines) {
489 TEWidget* te = getTe(); 489 TEWidget* te = getTe();
490 if (te != 0) { 490 if (te != 0) {
491 QSize size = te->calcSize(columns, lines); 491 QSize size = te->calcSize(columns, lines);
492 return size; 492 return size;
493 } else { 493 } else {
494 QSize size; 494 QSize size;
495 return size; 495 return size;
496 } 496 }
497} 497}
498 498
499/** 499/**
500 sets application window to a size based on columns X lines of the te 500 sets application window to a size based on columns X lines of the te
501 guest widget. Call with (0,0) for setting default size. 501 guest widget. Call with (0,0) for setting default size.
502*/ 502*/
503 503
504void Konsole::setColLin(int columns, int lines) 504void Konsole::setColLin(int columns, int lines)
505{ 505{
506 if ((columns==0) || (lines==0)) 506 if ((columns==0) || (lines==0))
507 { 507 {
508 if (defaultSize.isEmpty()) // not in config file : set default value 508 if (defaultSize.isEmpty()) // not in config file : set default value
509 { 509 {
510 defaultSize = calcSize(80,24); 510 defaultSize = calcSize(80,24);
511 // notifySize(24,80); // set menu items (strange arg order !) 511 // notifySize(24,80); // set menu items (strange arg order !)
512 } 512 }
513 resize(defaultSize); 513 resize(defaultSize);
514 } else { 514 } else {
515 resize(calcSize(columns, lines)); 515 resize(calcSize(columns, lines));
516 // notifySize(lines,columns); // set menu items (strange arg order !) 516 // notifySize(lines,columns); // set menu items (strange arg order !)
517 } 517 }
518} 518}
519 519
520/* 520/*
521void Konsole::setFont(int fontno) 521void Konsole::setFont(int fontno)
522{ 522{
523 QFont f; 523 QFont f;
524 if (fontno == 0) 524 if (fontno == 0)
525 f = defaultFont = QFont( "Helvetica", 12 ); 525 f = defaultFont = QFont( "Helvetica", 12 );
526 else 526 else
527 if (fonts[fontno][0] == '-') 527 if (fonts[fontno][0] == '-')
528 f.setRawName( fonts[fontno] ); 528 f.setRawName( fonts[fontno] );
529 else 529 else
530 { 530 {
531 f.setFamily(fonts[fontno]); 531 f.setFamily(fonts[fontno]);
532 f.setRawMode( TRUE ); 532 f.setRawMode( TRUE );
533 } 533 }
534 if ( !f.exactMatch() && fontno != 0) 534 if ( !f.exactMatch() && fontno != 0)
535 { 535 {
536 QString msg = i18n("Font `%1' not found.\nCheck README.linux.console for help.").arg(fonts[fontno]); 536 QString msg = i18n("Font `%1' not found.\nCheck README.linux.console for help.").arg(fonts[fontno]);
537 QMessageBox(this, msg); 537 QMessageBox(this, msg);
538 return; 538 return;
539 } 539 }
540 if (se) se->setFontNo(fontno); 540 if (se) se->setFontNo(fontno);
541 te->setVTFont(f); 541 te->setVTFont(f);
542 n_font = fontno; 542 n_font = fontno;
543} 543}
544*/ 544*/
545 545
546// --| color selection |------------------------------------------------------- 546// --| color selection |-------------------------------------------------------
547 547
548void Konsole::changeColumns(int columns) 548void Konsole::changeColumns(int columns)
549{ 549{
@@ -588,300 +588,300 @@ void Konsole::newSession() {
588 se->setHistory(b_scroll); 588 se->setHistory(b_scroll);
589 tab->setCurrentPage(nsessions); 589 tab->setCurrentPage(nsessions);
590 nsessions++; 590 nsessions++;
591 setColor(); 591 setColor();
592 } 592 }
593} 593}
594 594
595TEWidget* Konsole::getTe() { 595TEWidget* Konsole::getTe() {
596 if (nsessions) { 596 if (nsessions) {
597 return (TEWidget *) tab->currentPage(); 597 return (TEWidget *) tab->currentPage();
598 } else { 598 } else {
599 return 0; 599 return 0;
600 } 600 }
601} 601}
602 602
603void Konsole::switchSession(QWidget* w) { 603void Konsole::switchSession(QWidget* w) {
604 TEWidget* te = (TEWidget *) w; 604 TEWidget* te = (TEWidget *) w;
605 605
606 QFont teFnt = te->getVTFont(); 606 QFont teFnt = te->getVTFont();
607 for(uint i = 0; i < fonts.count(); i++) { 607 for(uint i = 0; i < fonts.count(); i++) {
608 VTFont *fnt = fonts.at(i); 608 VTFont *fnt = fonts.at(i);
609 bool cf = fnt->getFont() == teFnt; 609 bool cf = fnt->getFont() == teFnt;
610 fontList->setItemChecked(i, cf); 610 fontList->setItemChecked(i, cf);
611 if (cf) { 611 if (cf) {
612 cfont = i; 612 cfont = i;
613 } 613 }
614 } 614 }
615} 615}
616 616
617/// ------------------------------- some new stuff by L.J. Potter 617/// ------------------------------- some new stuff by L.J. Potter
618void Konsole::colorMenuSelected(int iD) 618void Konsole::colorMenuSelected(int iD)
619{ // this is NOT pretty, elegant or anything else besides functional 619{ // this is NOT pretty, elegant or anything else besides functional
620// QString temp; 620// QString temp;
621// qDebug( temp.sprintf("colormenu %d", iD)); 621// qDebug( temp.sprintf("colormenu %d", iD));
622 TEWidget* te = getTe(); 622 TEWidget* te = getTe();
623 Config cfg("Konsole"); 623 Config cfg("Konsole");
624 cfg.setGroup("Colors"); 624 cfg.setGroup("Colors");
625 QColor foreground; 625 QColor foreground;
626 QColor background; 626 QColor background;
627 colorMenu->setItemChecked(lastSelectedMenu,FALSE); 627 colorMenu->setItemChecked(lastSelectedMenu,FALSE);
628 ColorEntry m_table[TABLE_COLORS]; 628 ColorEntry m_table[TABLE_COLORS];
629 const ColorEntry * defaultCt=te->getdefaultColorTable(); 629 const ColorEntry * defaultCt=te->getdefaultColorTable();
630 /////////// fore back 630 /////////// fore back
631 int i; 631 int i;
632 if(iD==-9) { // default default 632 if(iD==-9) { // default default
633 for (i = 0; i < TABLE_COLORS; i++) { 633 for (i = 0; i < TABLE_COLORS; i++) {
634 m_table[i].color = defaultCt[i].color; 634 m_table[i].color = defaultCt[i].color;
635 if(i==1 || i == 11) 635 if(i==1 || i == 11)
636 m_table[i].transparent=1; 636 m_table[i].transparent=1;
637 cfg.writeEntry("Schema","98"); 637 cfg.writeEntry("Schema","98");
638 colorMenu->setItemChecked(-9,TRUE); 638 colorMenu->setItemChecked(-9,TRUE);
639 } 639 }
640 } else { 640 } else {
641 if(iD==-6) { // green black 641 if(iD==-6) { // green black
642 foreground.setRgb(0x18,255,0x18); 642 foreground.setRgb(0x18,255,0x18);
643 background.setRgb(0x00,0x00,0x00); 643 background.setRgb(0x00,0x00,0x00);
644 cfg.writeEntry("Schema","6"); 644 cfg.writeEntry("Schema","6");
645 colorMenu->setItemChecked(-6,TRUE); 645 colorMenu->setItemChecked(-6,TRUE);
646 } 646 }
647 if(iD==-7) { // black white 647 if(iD==-7) { // black white
648 foreground.setRgb(0x00,0x00,0x00); 648 foreground.setRgb(0x00,0x00,0x00);
649 background.setRgb(0xFF,0xFF,0xFF); 649 background.setRgb(0xFF,0xFF,0xFF);
650 cfg.writeEntry("Schema","7"); 650 cfg.writeEntry("Schema","7");
651 colorMenu->setItemChecked(-7,TRUE); 651 colorMenu->setItemChecked(-7,TRUE);
652 } 652 }
653 if(iD==-8) { // white black 653 if(iD==-8) { // white black
654 foreground.setRgb(0xFF,0xFF,0xFF); 654 foreground.setRgb(0xFF,0xFF,0xFF);
655 background.setRgb(0x00,0x00,0x00); 655 background.setRgb(0x00,0x00,0x00);
656 cfg.writeEntry("Schema","8"); 656 cfg.writeEntry("Schema","8");
657 colorMenu->setItemChecked(-8,TRUE); 657 colorMenu->setItemChecked(-8,TRUE);
658 } 658 }
659 if(iD==-10) {// Black, Red 659 if(iD==-10) {// Black, Red
660 foreground.setRgb(0x00,0x00,0x00); 660 foreground.setRgb(0x00,0x00,0x00);
661 background.setRgb(0xB2,0x18,0x18); 661 background.setRgb(0xB2,0x18,0x18);
662 cfg.writeEntry("Schema","10"); 662 cfg.writeEntry("Schema","10");
663 colorMenu->setItemChecked(-10,TRUE); 663 colorMenu->setItemChecked(-10,TRUE);
664 } 664 }
665 if(iD==-11) {// Red, Black 665 if(iD==-11) {// Red, Black
666 foreground.setRgb(230,31,31); //0xB2,0x18,0x18 666 foreground.setRgb(230,31,31); //0xB2,0x18,0x18
667 background.setRgb(0x00,0x00,0x00); 667 background.setRgb(0x00,0x00,0x00);
668 cfg.writeEntry("Schema","11"); 668 cfg.writeEntry("Schema","11");
669 colorMenu->setItemChecked(-11,TRUE); 669 colorMenu->setItemChecked(-11,TRUE);
670 } 670 }
671 if(iD==-12) {// Green, Yellow - is ugly 671 if(iD==-12) {// Green, Yellow - is ugly
672// foreground.setRgb(0x18,0xB2,0x18); 672// foreground.setRgb(0x18,0xB2,0x18);
673 foreground.setRgb(36,139,10); 673 foreground.setRgb(36,139,10);
674// background.setRgb(0xB2,0x68,0x18); 674// background.setRgb(0xB2,0x68,0x18);
675 background.setRgb(255,255,0); 675 background.setRgb(255,255,0);
676 cfg.writeEntry("Schema","12"); 676 cfg.writeEntry("Schema","12");
677 colorMenu->setItemChecked(-12,TRUE); 677 colorMenu->setItemChecked(-12,TRUE);
678 } 678 }
679 if(iD==-13) {// Blue, Magenta 679 if(iD==-13) {// Blue, Magenta
680 foreground.setRgb(0x18,0xB2,0xB2); 680 foreground.setRgb(0x18,0xB2,0xB2);
681 background.setRgb(0x18,0x18,0xB2); 681 background.setRgb(0x18,0x18,0xB2);
682 cfg.writeEntry("Schema","13"); 682 cfg.writeEntry("Schema","13");
683 colorMenu->setItemChecked(-13,TRUE); 683 colorMenu->setItemChecked(-13,TRUE);
684 } 684 }
685 if(iD==-14) {// Magenta, Blue 685 if(iD==-14) {// Magenta, Blue
686 foreground.setRgb(0x18,0x18,0xB2); 686 foreground.setRgb(0x18,0x18,0xB2);
687 background.setRgb(0x18,0xB2,0xB2); 687 background.setRgb(0x18,0xB2,0xB2);
688 cfg.writeEntry("Schema","14"); 688 cfg.writeEntry("Schema","14");
689 colorMenu->setItemChecked(-14,TRUE); 689 colorMenu->setItemChecked(-14,TRUE);
690 } 690 }
691 if(iD==-15) {// Cyan, White 691 if(iD==-15) {// Cyan, White
692 foreground.setRgb(0x18,0xB2,0xB2); 692 foreground.setRgb(0x18,0xB2,0xB2);
693 background.setRgb(0xFF,0xFF,0xFF); 693 background.setRgb(0xFF,0xFF,0xFF);
694 cfg.writeEntry("Schema","15"); 694 cfg.writeEntry("Schema","15");
695 colorMenu->setItemChecked(-15,TRUE); 695 colorMenu->setItemChecked(-15,TRUE);
696 } 696 }
697 if(iD==-16) {// White, Cyan 697 if(iD==-16) {// White, Cyan
698 background.setRgb(0x18,0xB2,0xB2); 698 background.setRgb(0x18,0xB2,0xB2);
699 foreground.setRgb(0xFF,0xFF,0xFF); 699 foreground.setRgb(0xFF,0xFF,0xFF);
700 cfg.writeEntry("Schema","16"); 700 cfg.writeEntry("Schema","16");
701 colorMenu->setItemChecked(-16,TRUE); 701 colorMenu->setItemChecked(-16,TRUE);
702 } 702 }
703 if(iD==-17) {// Black, Blue 703 if(iD==-17) {// Black, Blue
704 background.setRgb(0x00,0x00,0x00); 704 background.setRgb(0x00,0x00,0x00);
705 foreground.setRgb(0x18,0xB2,0xB2); 705 foreground.setRgb(0x18,0xB2,0xB2);
706 cfg.writeEntry("Schema","17"); 706 cfg.writeEntry("Schema","17");
707 colorMenu->setItemChecked(-17,TRUE); 707 colorMenu->setItemChecked(-17,TRUE);
708 } 708 }
709 if(iD==-18) {// Black, Gold 709 if(iD==-18) {// Black, Gold
710 background.setRgb(0x00,0x00,0x00); 710 background.setRgb(0x00,0x00,0x00);
711 foreground.setRgb(255,215,0); 711 foreground.setRgb(255,215,0);
712 cfg.writeEntry("Schema","18"); 712 cfg.writeEntry("Schema","18");
713 colorMenu->setItemChecked(-18,TRUE); 713 colorMenu->setItemChecked(-18,TRUE);
714 } 714 }
715 715
716 for (i = 0; i < TABLE_COLORS; i++) { 716 for (i = 0; i < TABLE_COLORS; i++) {
717 if(i==0 || i == 10) { 717 if(i==0 || i == 10) {
718 m_table[i].color = foreground; 718 m_table[i].color = foreground;
719 } 719 }
720 else if(i==1 || i == 11) { 720 else if(i==1 || i == 11) {
721 m_table[i].color = background; m_table[i].transparent=0; 721 m_table[i].color = background; m_table[i].transparent=0;
722 } 722 }
723 else 723 else
724 m_table[i].color = defaultCt[i].color; 724 m_table[i].color = defaultCt[i].color;
725 } 725 }
726 } 726 }
727 lastSelectedMenu = iD; 727 lastSelectedMenu = iD;
728 te->setColorTable(m_table); 728 te->setColorTable(m_table);
729 update(); 729 update();
730} 730}
731 731
732void Konsole::configMenuSelected(int iD) 732void Konsole::configMenuSelected(int iD)
733{ 733{
734// QString temp; 734// QString temp;
735// qDebug( temp.sprintf("configmenu %d",iD)); 735// qDebug( temp.sprintf("configmenu %d",iD));
736 TEWidget* te = getTe(); 736 TEWidget* te = getTe();
737 Config cfg("Konsole"); 737 Config cfg("Konsole");
738 cfg.setGroup("Menubar"); 738 cfg.setGroup("Menubar");
739 if( iD == -4) { 739 if( iD == -4) {
740 cfg.setGroup("Tabs"); 740 cfg.setGroup("Tabs");
741 QString tmp=cfg.readEntry("Position","Bottom"); 741 QString tmp=cfg.readEntry("Position","Bottom");
742 742
743 if(tmp=="Top") { 743 if(tmp=="Top") {
744 tab->setTabPosition(QTabWidget::Bottom); 744 tab->setTabPosition(QTabWidget::Bottom);
745 configMenu->changeItem( iD,"Tabs on Top"); 745 configMenu->changeItem( iD,"Tabs on Top");
746 cfg.writeEntry("Position","Bottom"); 746 cfg.writeEntry("Position","Bottom");
747 } else { 747 } else {
748 tab->setTabPosition(QTabWidget::Top); 748 tab->setTabPosition(QTabWidget::Top);
749 configMenu->changeItem( iD,"Tabs on Bottom"); 749 configMenu->changeItem( iD,"Tabs on Bottom");
750 cfg.writeEntry("Position","Top"); 750 cfg.writeEntry("Position","Top");
751 } 751 }
752 } 752 }
753} 753}
754 754
755void Konsole::changeCommand(const QString &text, int c) 755void Konsole::changeCommand(const QString &text, int c)
756{ 756{
757 Config cfg("Konsole"); 757 Config cfg("Konsole");
758 cfg.setGroup("Commands"); 758 cfg.setGroup("Commands");
759 if(commonCmds[c] != text) { 759 if(commonCmds[c] != text) {
760 cfg.writeEntry(QString::number(c),text); 760 cfg.writeEntry(QString::number(c),text);
761 commonCombo->clearEdit(); 761 commonCombo->clearEdit();
762 commonCombo->setCurrentItem(c); 762 commonCombo->setCurrentItem(c);
763 } 763 }
764} 764}
765 765
766void Konsole::setColor() 766void Konsole::setColor()
767{ 767{
768 Config cfg("Konsole"); 768 Config cfg("Konsole");
769 cfg.setGroup("Colors"); 769 cfg.setGroup("Colors");
770 int scheme = cfg.readNumEntry("Schema",1); 770 int scheme = cfg.readNumEntry("Schema",1);
771 if(scheme != 1) colorMenuSelected( -scheme); 771 if(scheme != 1) colorMenuSelected( -scheme);
772} 772}
773 773
774void Konsole::scrollMenuSelected(int index) 774void Konsole::scrollMenuSelected(int index)
775{ 775{
776// QString temp; 776// QString temp;
777// qDebug( temp.sprintf("scrollbar menu %d",index)); 777// qDebug( temp.sprintf("scrollbar menu %d",index));
778 TEWidget* te = getTe(); 778 TEWidget* te = getTe();
779 Config cfg("Konsole"); 779 Config cfg("Konsole");
780 cfg.setGroup("Scrollbar"); 780 cfg.setGroup("ScrollBar");
781 switch( index){ 781 switch( index){
782 case -24: 782 case -24:
783 te->setScrollbarLocation(0); 783 te->setScrollbarLocation(0);
784 cfg.writeEntry("Position",0); 784 cfg.writeEntry("Position",0);
785 break; 785 break;
786 case -25: 786 case -25:
787 te->setScrollbarLocation(1); 787 te->setScrollbarLocation(1);
788 cfg.writeEntry("Position",1); 788 cfg.writeEntry("Position",1);
789 break; 789 break;
790 case -26: 790 case -26:
791 te->setScrollbarLocation(2); 791 te->setScrollbarLocation(2);
792 cfg.writeEntry("Position",2); 792 cfg.writeEntry("Position",2);
793 break; 793 break;
794 }; 794 };
795 795
796} 796}
797 797
798void Konsole::editCommandListMenuSelected(int iD) 798void Konsole::editCommandListMenuSelected(int iD)
799{ 799{
800// QString temp; 800// QString temp;
801// qDebug( temp.sprintf("edit command list %d",iD)); 801// qDebug( temp.sprintf("edit command list %d",iD));
802 TEWidget* te = getTe(); 802 TEWidget* te = getTe();
803 Config cfg("Konsole"); 803 Config cfg("Konsole");
804 cfg.setGroup("Menubar"); 804 cfg.setGroup("Menubar");
805 if( iD == -3) { 805 if( iD == -3) {
806 if(!secondToolBar->isHidden()) { 806 if(!secondToolBar->isHidden()) {
807 secondToolBar->hide(); 807 secondToolBar->hide();
808 configMenu->changeItem( iD,tr( "Show Command List" )); 808 configMenu->changeItem( iD,tr( "Show Command List" ));
809 cfg.writeEntry("Hidden","TRUE"); 809 cfg.writeEntry("Hidden","TRUE");
810 configMenu->setItemEnabled(-22 ,FALSE); 810 configMenu->setItemEnabled(-22 ,FALSE);
811 } else { 811 } else {
812 secondToolBar->show(); 812 secondToolBar->show();
813 configMenu->changeItem( iD,tr( "Hide Command List" )); 813 configMenu->changeItem( iD,tr( "Hide Command List" ));
814 cfg.writeEntry("Hidden","FALSE"); 814 cfg.writeEntry("Hidden","FALSE");
815 configMenu->setItemEnabled(-22 ,TRUE); 815 configMenu->setItemEnabled(-22 ,TRUE);
816 816
817 if(cfg.readEntry("EditEnabled","FALSE")=="TRUE") { 817 if(cfg.readEntry("EditEnabled","FALSE")=="TRUE") {
818 configMenu->setItemChecked(-22,TRUE); 818 configMenu->setItemChecked(-22,TRUE);
819 commonCombo->setEditable( TRUE ); 819 commonCombo->setEditable( TRUE );
820 } else { 820 } else {
821 configMenu->setItemChecked(-22,FALSE); 821 configMenu->setItemChecked(-22,FALSE);
822 commonCombo->setEditable( FALSE ); 822 commonCombo->setEditable( FALSE );
823 } 823 }
824 } 824 }
825 } 825 }
826 if( iD == -22) { 826 if( iD == -22) {
827 cfg.setGroup("Commands"); 827 cfg.setGroup("Commands");
828// qDebug("enableCommandEdit"); 828// qDebug("enableCommandEdit");
829 if( !configMenu->isItemChecked(iD) ) { 829 if( !configMenu->isItemChecked(iD) ) {
830 commonCombo->setEditable( TRUE ); 830 commonCombo->setEditable( TRUE );
831 configMenu->setItemChecked(iD,TRUE); 831 configMenu->setItemChecked(iD,TRUE);
832 commonCombo->setCurrentItem(0); 832 commonCombo->setCurrentItem(0);
833 cfg.writeEntry("EditEnabled","TRUE"); 833 cfg.writeEntry("EditEnabled","TRUE");
834 } else { 834 } else {
835 commonCombo->setEditable( FALSE ); 835 commonCombo->setEditable( FALSE );
836 configMenu->setItemChecked(iD,FALSE); 836 configMenu->setItemChecked(iD,FALSE);
837 cfg.writeEntry("EditEnabled","FALSE"); 837 cfg.writeEntry("EditEnabled","FALSE");
838 commonCombo->setFocusPolicy(QWidget::NoFocus); 838 commonCombo->setFocusPolicy(QWidget::NoFocus);
839 te->setFocus(); 839 te->setFocus();
840 } 840 }
841 } 841 }
842 if(iD == -23) { 842 if(iD == -23) {
843 // "edit commands" 843 // "edit commands"
844 CommandEditDialog *m = new CommandEditDialog(this); 844 CommandEditDialog *m = new CommandEditDialog(this);
845 connect(m,SIGNAL(commandsEdited()),this,SLOT(initCommandList())); 845 connect(m,SIGNAL(commandsEdited()),this,SLOT(initCommandList()));
846 m->showMaximized(); 846 m->showMaximized();
847 } 847 }
848 848
849} 849}
850 850
851// $QPEDIR/bin/qcop QPE/Application/embeddedkonsole 'setDocument(QString)' 'ssh -V' 851// $QPEDIR/bin/qcop QPE/Application/embeddedkonsole 'setDocument(QString)' 'ssh -V'
852void Konsole::setDocument( const QString &cmd) { 852void Konsole::setDocument( const QString &cmd) {
853 newSession(); 853 newSession();
854 TEWidget* te = getTe(); 854 TEWidget* te = getTe();
855 if(cmd.find("-e", 0, TRUE) != -1) { 855 if(cmd.find("-e", 0, TRUE) != -1) {
856 QString cmd2; 856 QString cmd2;
857 cmd2=cmd.right(cmd.length()-3)+" &"; 857 cmd2=cmd.right(cmd.length()-3)+" &";
858 system(cmd2.latin1()); 858 system(cmd2.latin1());
859 if(startUp <= 1 && nsessions < 2) { 859 if(startUp <= 1 && nsessions < 2) {
860 doneSession(getTe()->currentSession, 0); 860 doneSession(getTe()->currentSession, 0);
861 exit(0); 861 exit(0);
862 } else 862 } else
863 doneSession(getTe()->currentSession, 0); 863 doneSession(getTe()->currentSession, 0);
864 } else { 864 } else {
865 if (te != 0) { 865 if (te != 0) {
866 te->emitText(cmd+"\r"); 866 te->emitText(cmd+"\r");
867 } 867 }
868 } 868 }
869 startUp++; 869 startUp++;
870} 870}
871 871
872void Konsole::parseCommandLine() { 872void Konsole::parseCommandLine() {
873 QString cmd; 873 QString cmd;
874 // newSession(); 874 // newSession();
875 for (int i=1;i< qApp->argc();i++) { 875 for (int i=1;i< qApp->argc();i++) {
876 if( QString(qApp->argv()[i]) == "-e") { 876 if( QString(qApp->argv()[i]) == "-e") {
877 i++; 877 i++;
878 for ( int j=i;j< qApp->argc();j++) { 878 for ( int j=i;j< qApp->argc();j++) {
879 cmd+=QString(qApp->argv()[j])+" "; 879 cmd+=QString(qApp->argv()[j])+" ";
880 } 880 }
881 cmd.stripWhiteSpace(); 881 cmd.stripWhiteSpace();
882 system(cmd.latin1()); 882 system(cmd.latin1());
883 exit(0);//close(); 883 exit(0);//close();
884 } // end -e switch 884 } // end -e switch
885 } 885 }
886 startUp++; 886 startUp++;
887} 887}