author | llornkcor <llornkcor> | 2004-04-07 07:31:34 (UTC) |
---|---|---|
committer | llornkcor <llornkcor> | 2004-04-07 07:31:34 (UTC) |
commit | 8934c3230dfab60e1ecef0a3c0cafa1e67be5c75 (patch) (unidiff) | |
tree | 0c0d48441c8fb6c6416a564f4a1472fd7e061503 | |
parent | 843ac5d18f43e7f79ea6144c93bde0bd0e3e2f40 (diff) | |
download | opie-8934c3230dfab60e1ecef0a3c0cafa1e67be5c75.zip opie-8934c3230dfab60e1ecef0a3c0cafa1e67be5c75.tar.gz opie-8934c3230dfab60e1ecef0a3c0cafa1e67be5c75.tar.bz2 |
move namespace into opie ifdef
-rw-r--r-- | core/apps/embeddedkonsole/konsole.cpp | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/core/apps/embeddedkonsole/konsole.cpp b/core/apps/embeddedkonsole/konsole.cpp index cbea7bd..ff5c2f1 100644 --- a/core/apps/embeddedkonsole/konsole.cpp +++ b/core/apps/embeddedkonsole/konsole.cpp | |||
@@ -1,244 +1,244 @@ | |||
1 | 1 | ||
2 | /* ---------------------------------------------------------------------- */ | 2 | /* ---------------------------------------------------------------------- */ |
3 | /* */ | 3 | /* */ |
4 | /* [main.C] Konsole */ | 4 | /* [main.C] Konsole */ |
5 | /* */ | 5 | /* */ |
6 | /* ---------------------------------------------------------------------- */ | 6 | /* ---------------------------------------------------------------------- */ |
7 | /* */ | 7 | /* */ |
8 | /* Copyright (c) 1997,1998 by Lars Doelle <lars.doelle@on-line.de> */ | 8 | /* Copyright (c) 1997,1998 by Lars Doelle <lars.doelle@on-line.de> */ |
9 | /* */ | 9 | /* */ |
10 | /* This file is part of Konsole, an X terminal. */ | 10 | /* This file is part of Konsole, an X terminal. */ |
11 | /* */ | 11 | /* */ |
12 | /* The material contained in here more or less directly orginates from */ | 12 | /* The material contained in here more or less directly orginates from */ |
13 | /* kvt, which is copyright (c) 1996 by Matthias Ettrich <ettrich@kde.org> */ | 13 | /* kvt, which is copyright (c) 1996 by Matthias Ettrich <ettrich@kde.org> */ |
14 | /* */ | 14 | /* */ |
15 | /* ---------------------------------------------------------------------- */ | 15 | /* ---------------------------------------------------------------------- */ |
16 | /* */ | 16 | /* */ |
17 | /* Ported Konsole to Qt/Embedded */ | 17 | /* Ported Konsole to Qt/Embedded */ |
18 | /* */ | 18 | /* */ |
19 | /* Copyright (C) 2000 by John Ryland <jryland@trolltech.com> */ | 19 | /* Copyright (C) 2000 by John Ryland <jryland@trolltech.com> */ |
20 | /* */ | 20 | /* */ |
21 | /* -------------------------------------------------------------------------- */ | 21 | /* -------------------------------------------------------------------------- */ |
22 | // enhancements added by L.J. Potter <ljp@llornkcor.com> | 22 | // enhancements added by L.J. Potter <ljp@llornkcor.com> |
23 | // enhancements added by Phillip Kuhn | 23 | // enhancements added by Phillip Kuhn |
24 | 24 | ||
25 | #include <stdlib.h> | 25 | #include <stdlib.h> |
26 | #include <sys/types.h> | 26 | #include <sys/types.h> |
27 | #include <pwd.h> | 27 | #include <pwd.h> |
28 | #include <unistd.h> | 28 | #include <unistd.h> |
29 | 29 | ||
30 | #ifdef QT_QWS_OPIE | 30 | #ifdef QT_QWS_OPIE |
31 | #include <opie2/ocolorpopupmenu.h> | 31 | #include <opie2/ocolorpopupmenu.h> |
32 | using namespace Opie; | ||
32 | #endif | 33 | #endif |
33 | 34 | ||
34 | #include <qpe/resource.h> | 35 | #include <qpe/resource.h> |
35 | 36 | ||
36 | #include <qmenubar.h> | 37 | #include <qmenubar.h> |
37 | #include <qtabbar.h> | 38 | #include <qtabbar.h> |
38 | #include <qpe/config.h> | 39 | #include <qpe/config.h> |
39 | #include <qfontdatabase.h> | 40 | #include <qfontdatabase.h> |
40 | #include <qfile.h> | 41 | #include <qfile.h> |
41 | #include <qspinbox.h> | 42 | #include <qspinbox.h> |
42 | #include <qlayout.h> | 43 | #include <qlayout.h> |
43 | 44 | ||
44 | #include <sys/wait.h> | 45 | #include <sys/wait.h> |
45 | #include <stdio.h> | 46 | #include <stdio.h> |
46 | #include <stdlib.h> | 47 | #include <stdlib.h> |
47 | #include <assert.h> | 48 | #include <assert.h> |
48 | 49 | ||
49 | #include "konsole.h" | 50 | #include "konsole.h" |
50 | #include "commandeditdialog.h" | 51 | #include "commandeditdialog.h" |
51 | 52 | ||
52 | using namespace Opie; | ||
53 | class EKNumTabBar : public QTabBar | 53 | class EKNumTabBar : public QTabBar |
54 | { | 54 | { |
55 | public: | 55 | public: |
56 | EKNumTabBar(QWidget *parent = 0, const char *name = 0) : | 56 | EKNumTabBar(QWidget *parent = 0, const char *name = 0) : |
57 | QTabBar(parent, name) | 57 | QTabBar(parent, name) |
58 | {} | 58 | {} |
59 | 59 | ||
60 | // QList<QTab> *getTabList() { return(tabList()); } | 60 | // QList<QTab> *getTabList() { return(tabList()); } |
61 | 61 | ||
62 | void numberTabs() | 62 | void numberTabs() |
63 | { | 63 | { |
64 | // Yes, it really is this messy. QTabWidget needs functions | 64 | // Yes, it really is this messy. QTabWidget needs functions |
65 | // that provide acces to tabs in a sequential way. | 65 | // that provide acces to tabs in a sequential way. |
66 | int m=INT_MIN; | 66 | int m=INT_MIN; |
67 | for (int i=0; i<count(); i++) | 67 | for (int i=0; i<count(); i++) |
68 | { | 68 | { |
69 | QTab* left=0; | 69 | QTab* left=0; |
70 | QListIterator<QTab> it(*tabList()); | 70 | QListIterator<QTab> it(*tabList()); |
71 | int x=INT_MAX; | 71 | int x=INT_MAX; |
72 | for( QTab* t; (t=it.current()); ++it ) | 72 | for( QTab* t; (t=it.current()); ++it ) |
73 | { | 73 | { |
74 | int tx = t->rect().x(); | 74 | int tx = t->rect().x(); |
75 | if ( tx<x && tx>m ) | 75 | if ( tx<x && tx>m ) |
76 | { | 76 | { |
77 | x = tx; | 77 | x = tx; |
78 | left = t; | 78 | left = t; |
79 | } | 79 | } |
80 | } | 80 | } |
81 | if ( left ) | 81 | if ( left ) |
82 | { | 82 | { |
83 | left->setText(QString::number(i+1)); | 83 | left->setText(QString::number(i+1)); |
84 | m = left->rect().x(); | 84 | m = left->rect().x(); |
85 | } | 85 | } |
86 | } | 86 | } |
87 | } | 87 | } |
88 | 88 | ||
89 | virtual QSize sizeHint() const | 89 | virtual QSize sizeHint() const |
90 | { | 90 | { |
91 | if (isHidden()) | 91 | if (isHidden()) |
92 | { | 92 | { |
93 | return(QSize(0,0)); | 93 | return(QSize(0,0)); |
94 | } | 94 | } |
95 | else | 95 | else |
96 | { | 96 | { |
97 | QSize size = QTabBar::sizeHint(); | 97 | QSize size = QTabBar::sizeHint(); |
98 | int shrink = 5; | 98 | int shrink = 5; |
99 | if (qApp->desktop()->width() > 600 || qApp->desktop()->height() > 600) | 99 | if (qApp->desktop()->width() > 600 || qApp->desktop()->height() > 600) |
100 | { | 100 | { |
101 | shrink = 10; | 101 | shrink = 10; |
102 | } | 102 | } |
103 | size.setHeight(size.height() - shrink); | 103 | size.setHeight(size.height() - shrink); |
104 | return(size); | 104 | return(size); |
105 | } | 105 | } |
106 | } | 106 | } |
107 | 107 | ||
108 | }; | 108 | }; |
109 | 109 | ||
110 | class EKNumTabWidget : public QTabWidget | 110 | class EKNumTabWidget : public QTabWidget |
111 | { | 111 | { |
112 | public: | 112 | public: |
113 | EKNumTabWidget(QWidget* parent) : QTabWidget(parent) | 113 | EKNumTabWidget(QWidget* parent) : QTabWidget(parent) |
114 | { | 114 | { |
115 | setTabBar(new EKNumTabBar(parent,"EKTabBar")); | 115 | setTabBar(new EKNumTabBar(parent,"EKTabBar")); |
116 | setSizePolicy( QSizePolicy( QSizePolicy::Expanding, QSizePolicy::Expanding ) ); | 116 | setSizePolicy( QSizePolicy( QSizePolicy::Expanding, QSizePolicy::Expanding ) ); |
117 | } | 117 | } |
118 | 118 | ||
119 | EKNumTabBar *getTabBar() const | 119 | EKNumTabBar *getTabBar() const |
120 | { | 120 | { |
121 | return ((EKNumTabBar*)tabBar()); | 121 | return ((EKNumTabBar*)tabBar()); |
122 | } | 122 | } |
123 | 123 | ||
124 | 124 | ||
125 | void addTab(QWidget* w) | 125 | void addTab(QWidget* w) |
126 | { | 126 | { |
127 | QTab* t = new QTab(QString::number(tabBar()->count()+1)); | 127 | QTab* t = new QTab(QString::number(tabBar()->count()+1)); |
128 | QTabWidget::addTab(w,t); | 128 | QTabWidget::addTab(w,t); |
129 | } | 129 | } |
130 | 130 | ||
131 | void removeTab(QWidget* w) | 131 | void removeTab(QWidget* w) |
132 | { | 132 | { |
133 | removePage(w); | 133 | removePage(w); |
134 | ((EKNumTabBar*)tabBar())->numberTabs(); | 134 | ((EKNumTabBar*)tabBar())->numberTabs(); |
135 | } | 135 | } |
136 | }; | 136 | }; |
137 | 137 | ||
138 | // This could be configurable or dynamicly generated from the bash history | 138 | // This could be configurable or dynamicly generated from the bash history |
139 | // file of the user | 139 | // file of the user |
140 | static const char *commonCmds[] = | 140 | static const char *commonCmds[] = |
141 | { | 141 | { |
142 | "ls ", // I left this here, cause it looks better than the first alpha | 142 | "ls ", // I left this here, cause it looks better than the first alpha |
143 | "cardctl eject", | 143 | "cardctl eject", |
144 | "cat ", | 144 | "cat ", |
145 | "cd ", | 145 | "cd ", |
146 | "chmod ", | 146 | "chmod ", |
147 | "clear", | 147 | "clear", |
148 | "cp ", | 148 | "cp ", |
149 | "dc ", | 149 | "dc ", |
150 | "df ", | 150 | "df ", |
151 | "dmesg", | 151 | "dmesg", |
152 | "echo ", | 152 | "echo ", |
153 | "env", | 153 | "env", |
154 | "find ", | 154 | "find ", |
155 | "free", | 155 | "free", |
156 | "grep ", | 156 | "grep ", |
157 | "ifconfig ", | 157 | "ifconfig ", |
158 | "ipkg ", | 158 | "ipkg ", |
159 | "mkdir ", | 159 | "mkdir ", |
160 | "mv ", | 160 | "mv ", |
161 | "nc localhost 7776", | 161 | "nc localhost 7776", |
162 | "nc localhost 7777", | 162 | "nc localhost 7777", |
163 | "netstat ", | 163 | "netstat ", |
164 | "nslookup ", | 164 | "nslookup ", |
165 | "ping ", | 165 | "ping ", |
166 | "ps aux", | 166 | "ps aux", |
167 | "pwd ", | 167 | "pwd ", |
168 | "qcop QPE/System 'linkChanged(QString)' ''", | 168 | "qcop QPE/System 'linkChanged(QString)' ''", |
169 | "qcop QPE/System 'restart()'", | 169 | "qcop QPE/System 'restart()'", |
170 | "qcop QPE/System 'quit()'", | 170 | "qcop QPE/System 'quit()'", |
171 | "rm ", | 171 | "rm ", |
172 | "rmdir ", | 172 | "rmdir ", |
173 | "route ", | 173 | "route ", |
174 | "set ", | 174 | "set ", |
175 | "traceroute", | 175 | "traceroute", |
176 | 176 | ||
177 | /* | 177 | /* |
178 | "gzip", | 178 | "gzip", |
179 | "gunzip", | 179 | "gunzip", |
180 | "chgrp", | 180 | "chgrp", |
181 | "chown", | 181 | "chown", |
182 | "date", | 182 | "date", |
183 | "dd", | 183 | "dd", |
184 | "df", | 184 | "df", |
185 | "dmesg", | 185 | "dmesg", |
186 | "fuser", | 186 | "fuser", |
187 | "hostname", | 187 | "hostname", |
188 | "kill", | 188 | "kill", |
189 | "killall", | 189 | "killall", |
190 | "ln", | 190 | "ln", |
191 | "ping", | 191 | "ping", |
192 | "mount", | 192 | "mount", |
193 | "more", | 193 | "more", |
194 | "sort", | 194 | "sort", |
195 | "touch", | 195 | "touch", |
196 | "umount", | 196 | "umount", |
197 | "mknod", | 197 | "mknod", |
198 | "netstat", | 198 | "netstat", |
199 | */ | 199 | */ |
200 | 200 | ||
201 | "exit", | 201 | "exit", |
202 | NULL | 202 | NULL |
203 | }; | 203 | }; |
204 | 204 | ||
205 | 205 | ||
206 | static void konsoleInit(const char** shell) { | 206 | static void konsoleInit(const char** shell) { |
207 | if(setuid(getuid()) !=0) qDebug("setuid failed"); | 207 | if(setuid(getuid()) !=0) qDebug("setuid failed"); |
208 | if(setgid(getgid()) != 0) qDebug("setgid failed"); // drop privileges | 208 | if(setgid(getgid()) != 0) qDebug("setgid failed"); // drop privileges |
209 | 209 | ||
210 | 210 | ||
211 | // QPEApplication::grabKeyboard(); // for CTRL and ALT | 211 | // QPEApplication::grabKeyboard(); // for CTRL and ALT |
212 | 212 | ||
213 | qDebug("keyboard grabbed"); | 213 | qDebug("keyboard grabbed"); |
214 | #ifdef FAKE_CTRL_AND_ALT | 214 | #ifdef FAKE_CTRL_AND_ALT |
215 | qDebug("Fake Ctrl and Alt defined"); | 215 | qDebug("Fake Ctrl and Alt defined"); |
216 | QPEApplication::grabKeyboard(); // for CTRL and ALT | 216 | QPEApplication::grabKeyboard(); // for CTRL and ALT |
217 | #endif | 217 | #endif |
218 | 218 | ||
219 | *shell = getenv("SHELL"); | 219 | *shell = getenv("SHELL"); |
220 | qWarning("SHell initially is %s", *shell ); | 220 | qWarning("SHell initially is %s", *shell ); |
221 | 221 | ||
222 | if (shell == NULL || *shell == '\0') { | 222 | if (shell == NULL || *shell == '\0') { |
223 | struct passwd *ent = 0; | 223 | struct passwd *ent = 0; |
224 | uid_t me = getuid(); | 224 | uid_t me = getuid(); |
225 | *shell = "/bin/sh"; | 225 | *shell = "/bin/sh"; |
226 | 226 | ||
227 | while ( (ent = getpwent()) != 0 ) { | 227 | while ( (ent = getpwent()) != 0 ) { |
228 | if (ent->pw_uid == me) { | 228 | if (ent->pw_uid == me) { |
229 | if (ent->pw_shell != "") | 229 | if (ent->pw_shell != "") |
230 | *shell = ent->pw_shell; | 230 | *shell = ent->pw_shell; |
231 | break; | 231 | break; |
232 | } | 232 | } |
233 | } | 233 | } |
234 | endpwent(); | 234 | endpwent(); |
235 | } | 235 | } |
236 | 236 | ||
237 | if( putenv((char*)"COLORTERM=") !=0) | 237 | if( putenv((char*)"COLORTERM=") !=0) |
238 | qDebug("putenv failed"); // to trigger mc's color detection | 238 | qDebug("putenv failed"); // to trigger mc's color detection |
239 | } | 239 | } |
240 | 240 | ||
241 | 241 | ||
242 | Konsole::Konsole(QWidget* parent, const char* name, WFlags fl) : | 242 | Konsole::Konsole(QWidget* parent, const char* name, WFlags fl) : |
243 | QMainWindow(parent, name, fl) | 243 | QMainWindow(parent, name, fl) |
244 | { | 244 | { |
@@ -324,386 +324,386 @@ void Konsole::initCommandList() | |||
324 | { | 324 | { |
325 | items.append(new HistoryItem(lineno, line)); | 325 | items.append(new HistoryItem(lineno, line)); |
326 | } | 326 | } |
327 | } | 327 | } |
328 | items.sort(); | 328 | items.sort(); |
329 | int n = items.count(); | 329 | int n = items.count(); |
330 | if (n > 40) | 330 | if (n > 40) |
331 | { | 331 | { |
332 | n = 40; | 332 | n = 40; |
333 | } | 333 | } |
334 | for(int i=0; i<n; i++) | 334 | for(int i=0; i<n; i++) |
335 | { | 335 | { |
336 | // should insert start of command, but keep whole thing | 336 | // should insert start of command, but keep whole thing |
337 | if (items.at(items.count()-i-1)->line.length() < 30) | 337 | if (items.at(items.count()-i-1)->line.length() < 30) |
338 | { | 338 | { |
339 | commonCombo->insertItem(items.at(items.count()-i-1)->line); | 339 | commonCombo->insertItem(items.at(items.count()-i-1)->line); |
340 | } | 340 | } |
341 | } | 341 | } |
342 | histfile.close(); | 342 | histfile.close(); |
343 | } | 343 | } |
344 | } | 344 | } |
345 | if (cfg.readEntry("Commands Set","FALSE") == "FALSE") | 345 | if (cfg.readEntry("Commands Set","FALSE") == "FALSE") |
346 | { | 346 | { |
347 | for (int i = 0; commonCmds[i] != NULL; i++) | 347 | for (int i = 0; commonCmds[i] != NULL; i++) |
348 | { | 348 | { |
349 | commonCombo->insertItem(commonCmds[i]); | 349 | commonCombo->insertItem(commonCmds[i]); |
350 | } | 350 | } |
351 | } | 351 | } |
352 | else | 352 | else |
353 | { | 353 | { |
354 | for (int i = 0; i < 100; i++) | 354 | for (int i = 0; i < 100; i++) |
355 | { | 355 | { |
356 | if (!(cfg.readEntry( QString::number(i),"")).isEmpty()) | 356 | if (!(cfg.readEntry( QString::number(i),"")).isEmpty()) |
357 | commonCombo->insertItem(cfg.readEntry( QString::number(i),"")); | 357 | commonCombo->insertItem(cfg.readEntry( QString::number(i),"")); |
358 | } | 358 | } |
359 | } | 359 | } |
360 | 360 | ||
361 | 361 | ||
362 | } | 362 | } |
363 | 363 | ||
364 | static void sig_handler(int x) | 364 | static void sig_handler(int x) |
365 | { | 365 | { |
366 | printf("got signal %d\n",x); | 366 | printf("got signal %d\n",x); |
367 | } | 367 | } |
368 | 368 | ||
369 | void Konsole::init(const char* _pgm, QStrList & _args) | 369 | void Konsole::init(const char* _pgm, QStrList & _args) |
370 | { | 370 | { |
371 | 371 | ||
372 | #if 0 | 372 | #if 0 |
373 | for(int i=1; i<=31; i++) | 373 | for(int i=1; i<=31; i++) |
374 | { | 374 | { |
375 | if (i != SIGPIPE && i != SIGPROF && i != SIGSEGV | 375 | if (i != SIGPIPE && i != SIGPROF && i != SIGSEGV |
376 | && i != SIGINT && i != SIGILL && i != SIGTERM | 376 | && i != SIGINT && i != SIGILL && i != SIGTERM |
377 | && i != SIGBUS) | 377 | && i != SIGBUS) |
378 | signal(i,sig_handler); | 378 | signal(i,sig_handler); |
379 | } | 379 | } |
380 | #endif | 380 | #endif |
381 | signal(SIGSTOP, sig_handler); | 381 | signal(SIGSTOP, sig_handler); |
382 | signal(SIGCONT, sig_handler); | 382 | signal(SIGCONT, sig_handler); |
383 | signal(SIGTSTP, sig_handler); | 383 | signal(SIGTSTP, sig_handler); |
384 | 384 | ||
385 | b_scroll = TRUE; // histon; | 385 | b_scroll = TRUE; // histon; |
386 | n_keytab = 0; | 386 | n_keytab = 0; |
387 | n_render = 0; | 387 | n_render = 0; |
388 | startUp=0; | 388 | startUp=0; |
389 | fromMenu = FALSE; | 389 | fromMenu = FALSE; |
390 | fullscreen = false; | 390 | fullscreen = false; |
391 | 391 | ||
392 | setCaption( tr( "Konsole" ) ); | 392 | setCaption( tr( "Konsole" ) ); |
393 | setIcon( Resource::loadPixmap( "konsole/Terminal" ) ); | 393 | setIcon( Resource::loadPixmap( "konsole/Terminal" ) ); |
394 | 394 | ||
395 | Config cfg( "Konsole" ); | 395 | Config cfg( "Konsole" ); |
396 | cfg.setGroup("Font"); | 396 | cfg.setGroup("Font"); |
397 | QString tmp; | 397 | QString tmp; |
398 | 398 | ||
399 | // initialize the list of allowed fonts /////////////////////////////////// | 399 | // initialize the list of allowed fonts /////////////////////////////////// |
400 | 400 | ||
401 | QString cfgFontName = cfg.readEntry("FontName","Lcfont"); | 401 | QString cfgFontName = cfg.readEntry("FontName","Lcfont"); |
402 | int cfgFontSize = cfg.readNumEntry("FontSize",18); | 402 | int cfgFontSize = cfg.readNumEntry("FontSize",18); |
403 | 403 | ||
404 | cfont = -1; | 404 | cfont = -1; |
405 | 405 | ||
406 | // this code causes repeated access to all the font files | 406 | // this code causes repeated access to all the font files |
407 | // which does slow down startup | 407 | // which does slow down startup |
408 | QFontDatabase fontDB; | 408 | QFontDatabase fontDB; |
409 | QStringList familyNames; | 409 | QStringList familyNames; |
410 | familyNames = fontDB.families( FALSE ); | 410 | familyNames = fontDB.families( FALSE ); |
411 | QString s; | 411 | QString s; |
412 | int fontIndex = 0; | 412 | int fontIndex = 0; |
413 | int familyNum = 0; | 413 | int familyNum = 0; |
414 | fontList = new QPopupMenu( this ); | 414 | fontList = new QPopupMenu( this ); |
415 | 415 | ||
416 | for(uint j = 0; j < (uint)familyNames.count(); j++) | 416 | for(uint j = 0; j < (uint)familyNames.count(); j++) |
417 | { | 417 | { |
418 | s = familyNames[j]; | 418 | s = familyNames[j]; |
419 | if ( s.contains('-') ) | 419 | if ( s.contains('-') ) |
420 | { | 420 | { |
421 | int i = s.find('-'); | 421 | int i = s.find('-'); |
422 | s = s.right( s.length() - i - 1 ) + " [" + s.left( i ) + "]"; | 422 | s = s.right( s.length() - i - 1 ) + " [" + s.left( i ) + "]"; |
423 | } | 423 | } |
424 | s[0] = s[0].upper(); | 424 | s[0] = s[0].upper(); |
425 | 425 | ||
426 | QValueList<int> sizes = fontDB.pointSizes( familyNames[j] ); | 426 | QValueList<int> sizes = fontDB.pointSizes( familyNames[j] ); |
427 | 427 | ||
428 | printf("family[%d] = %s with %d sizes\n", j, familyNames[j].latin1(), | 428 | printf("family[%d] = %s with %d sizes\n", j, familyNames[j].latin1(), |
429 | sizes.count()); | 429 | sizes.count()); |
430 | 430 | ||
431 | if (sizes.count() > 0) | 431 | if (sizes.count() > 0) |
432 | { | 432 | { |
433 | QPopupMenu *sizeMenu; | 433 | QPopupMenu *sizeMenu; |
434 | QFont f; | 434 | QFont f; |
435 | int last_width = -1; | 435 | int last_width = -1; |
436 | sizeMenu = NULL; | 436 | sizeMenu = NULL; |
437 | 437 | ||
438 | for(uint i = 0; i < (uint)sizes.count() + 4; i++) | 438 | for(uint i = 0; i < (uint)sizes.count() + 4; i++) |
439 | { | 439 | { |
440 | // printf("family %s size %d ", familyNames[j].latin1(), sizes[i]); | 440 | // printf("family %s size %d ", familyNames[j].latin1(), sizes[i]); |
441 | // need to divide by 10 on the Z, but not otherwise | 441 | // need to divide by 10 on the Z, but not otherwise |
442 | int size; | 442 | int size; |
443 | 443 | ||
444 | if (i >= (uint)sizes.count()) | 444 | if (i >= (uint)sizes.count()) |
445 | { | 445 | { |
446 | // try for expandable fonts | 446 | // try for expandable fonts |
447 | size = sizes[sizes.count()-1] + 2 * (i - sizes.count() + 1); | 447 | size = sizes[sizes.count()-1] + 2 * (i - sizes.count() + 1); |
448 | } | 448 | } |
449 | else | 449 | else |
450 | { | 450 | { |
451 | printf("sizes[%d] = %d\n", i, sizes[i]); | 451 | printf("sizes[%d] = %d\n", i, sizes[i]); |
452 | size = sizes[i]; | 452 | size = sizes[i]; |
453 | } | 453 | } |
454 | 454 | ||
455 | f = QFont(familyNames[j], size); | 455 | f = QFont(familyNames[j], size); |
456 | f.setFixedPitch(true); | 456 | f.setFixedPitch(true); |
457 | QFontMetrics fm(f); | 457 | QFontMetrics fm(f); |
458 | // don't trust f.fixedPitch() or f.exactMatch(), they lie!! | 458 | // don't trust f.fixedPitch() or f.exactMatch(), they lie!! |
459 | if (fm.width("l") == fm.width("m") | 459 | if (fm.width("l") == fm.width("m") |
460 | && (i < (uint)sizes.count() | 460 | && (i < (uint)sizes.count() |
461 | || fm.width("m") > last_width)) | 461 | || fm.width("m") > last_width)) |
462 | { | 462 | { |
463 | if (i < (uint)sizes.count()) | 463 | if (i < (uint)sizes.count()) |
464 | { | 464 | { |
465 | last_width = fm.width("m"); | 465 | last_width = fm.width("m"); |
466 | } | 466 | } |
467 | if (sizeMenu == NULL) | 467 | if (sizeMenu == NULL) |
468 | { | 468 | { |
469 | sizeMenu = new QPopupMenu(); | 469 | sizeMenu = new QPopupMenu(); |
470 | } | 470 | } |
471 | int id = sizeMenu->insertItem(QString("%1").arg(size), fontIndex); | 471 | int id = sizeMenu->insertItem(QString("%1").arg(size), fontIndex); |
472 | sizeMenu->setItemParameter(id, fontIndex); | 472 | sizeMenu->setItemParameter(id, fontIndex); |
473 | sizeMenu->connectItem(id, this, SLOT(setFont(int))); | 473 | sizeMenu->connectItem(id, this, SLOT(setFont(int))); |
474 | QString name = s + " " + QString::number(size); | 474 | QString name = s + " " + QString::number(size); |
475 | fonts.append(new VTFont(name, f, familyNames[j], familyNum, size)); | 475 | fonts.append(new VTFont(name, f, familyNames[j], familyNum, size)); |
476 | if (familyNames[j] == cfgFontName && size == cfgFontSize) | 476 | if (familyNames[j] == cfgFontName && size == cfgFontSize) |
477 | { | 477 | { |
478 | cfont = fontIndex; | 478 | cfont = fontIndex; |
479 | } | 479 | } |
480 | printf("FOUND: %s family %s size %d\n", name.latin1(), familyNames[j].latin1(), size); | 480 | printf("FOUND: %s family %s size %d\n", name.latin1(), familyNames[j].latin1(), size); |
481 | fontIndex++; | 481 | fontIndex++; |
482 | } | 482 | } |
483 | } | 483 | } |
484 | if (sizeMenu) | 484 | if (sizeMenu) |
485 | { | 485 | { |
486 | fontList->insertItem(s, sizeMenu, familyNum + 1000); | 486 | fontList->insertItem(s, sizeMenu, familyNum + 1000); |
487 | 487 | ||
488 | familyNum++; | 488 | familyNum++; |
489 | } | 489 | } |
490 | } | 490 | } |
491 | 491 | ||
492 | } | 492 | } |
493 | 493 | ||
494 | if (cfont < 0 || cfont >= (int)fonts.count()) | 494 | if (cfont < 0 || cfont >= (int)fonts.count()) |
495 | { | 495 | { |
496 | cfont = 0; | 496 | cfont = 0; |
497 | } | 497 | } |
498 | 498 | ||
499 | // create terminal emulation framework //////////////////////////////////// | 499 | // create terminal emulation framework //////////////////////////////////// |
500 | nsessions = 0; | 500 | nsessions = 0; |
501 | 501 | ||
502 | tab = new EKNumTabWidget(this); | 502 | tab = new EKNumTabWidget(this); |
503 | // tab->setMargin(tab->margin()-5); | 503 | // tab->setMargin(tab->margin()-5); |
504 | connect(tab, SIGNAL(currentChanged(QWidget*)), this, SLOT(switchSession(QWidget*))); | 504 | connect(tab, SIGNAL(currentChanged(QWidget*)), this, SLOT(switchSession(QWidget*))); |
505 | 505 | ||
506 | // create terminal toolbar //////////////////////////////////////////////// | 506 | // create terminal toolbar //////////////////////////////////////////////// |
507 | setToolBarsMovable( FALSE ); | 507 | setToolBarsMovable( FALSE ); |
508 | menuToolBar = new QToolBar( this ); | 508 | menuToolBar = new QToolBar( this ); |
509 | menuToolBar->setHorizontalStretchable( TRUE ); | 509 | menuToolBar->setHorizontalStretchable( TRUE ); |
510 | 510 | ||
511 | QMenuBar *menuBar = new QMenuBar( menuToolBar ); | 511 | QMenuBar *menuBar = new QMenuBar( menuToolBar ); |
512 | 512 | ||
513 | setFont(cfont); | 513 | setFont(cfont); |
514 | 514 | ||
515 | configMenu = new QPopupMenu( this); | 515 | configMenu = new QPopupMenu( this); |
516 | colorMenu = new QPopupMenu( this); | 516 | colorMenu = new QPopupMenu( this); |
517 | scrollMenu = new QPopupMenu( this); | 517 | scrollMenu = new QPopupMenu( this); |
518 | editCommandListMenu = new QPopupMenu( this); | 518 | editCommandListMenu = new QPopupMenu( this); |
519 | 519 | ||
520 | configMenu->insertItem(tr("Command List"), editCommandListMenu); | 520 | configMenu->insertItem(tr("Command List"), editCommandListMenu); |
521 | 521 | ||
522 | bool listHidden; | 522 | bool listHidden; |
523 | cfg.setGroup("Menubar"); | 523 | cfg.setGroup("Menubar"); |
524 | if( cfg.readEntry("Hidden","FALSE") == "TRUE") | 524 | if( cfg.readEntry("Hidden","FALSE") == "TRUE") |
525 | { | 525 | { |
526 | ec_cmdlist = editCommandListMenu->insertItem( tr( "Show command list" )); | 526 | ec_cmdlist = editCommandListMenu->insertItem( tr( "Show command list" )); |
527 | listHidden=TRUE; | 527 | listHidden=TRUE; |
528 | } | 528 | } |
529 | else | 529 | else |
530 | { | 530 | { |
531 | ec_cmdlist = editCommandListMenu->insertItem( tr( "Hide command list" )); | 531 | ec_cmdlist = editCommandListMenu->insertItem( tr( "Hide command list" )); |
532 | listHidden=FALSE; | 532 | listHidden=FALSE; |
533 | } | 533 | } |
534 | 534 | ||
535 | cfg.setGroup("Tabs"); | 535 | cfg.setGroup("Tabs"); |
536 | 536 | ||
537 | tabMenu = new QPopupMenu(this); | 537 | tabMenu = new QPopupMenu(this); |
538 | tm_bottom = tabMenu->insertItem(tr("Bottom" )); | 538 | tm_bottom = tabMenu->insertItem(tr("Bottom" )); |
539 | tm_top = tabMenu->insertItem(tr("Top")); | 539 | tm_top = tabMenu->insertItem(tr("Top")); |
540 | tm_hidden = tabMenu->insertItem(tr("Hidden")); | 540 | tm_hidden = tabMenu->insertItem(tr("Hidden")); |
541 | 541 | ||
542 | configMenu->insertItem(tr("Tabs"), tabMenu); | 542 | configMenu->insertItem(tr("Tabs"), tabMenu); |
543 | 543 | ||
544 | tmp=cfg.readEntry("Position","Top"); | 544 | tmp=cfg.readEntry("Position","Top"); |
545 | if(tmp=="Top") | 545 | if(tmp=="Top") |
546 | { | 546 | { |
547 | tab->setTabPosition(QTabWidget::Top); | 547 | tab->setTabPosition(QTabWidget::Top); |
548 | tab->getTabBar()->show(); | 548 | tab->getTabBar()->show(); |
549 | tabPos = tm_top; | 549 | tabPos = tm_top; |
550 | } | 550 | } |
551 | else if (tmp=="Bottom") | 551 | else if (tmp=="Bottom") |
552 | { | 552 | { |
553 | tab->setTabPosition(QTabWidget::Bottom); | 553 | tab->setTabPosition(QTabWidget::Bottom); |
554 | tab->getTabBar()->show(); | 554 | tab->getTabBar()->show(); |
555 | tabPos = tm_bottom; | 555 | tabPos = tm_bottom; |
556 | } | 556 | } |
557 | else | 557 | else |
558 | { | 558 | { |
559 | tab->getTabBar()->hide(); | 559 | tab->getTabBar()->hide(); |
560 | tab->setMargin(tab->margin()); | 560 | tab->setMargin(tab->margin()); |
561 | tabPos = tm_hidden; | 561 | tabPos = tm_hidden; |
562 | } | 562 | } |
563 | 563 | ||
564 | cm_bw = colorMenu->insertItem(tr( "Black on White")); | 564 | cm_bw = colorMenu->insertItem(tr( "Black on White")); |
565 | cm_wb = colorMenu->insertItem(tr( "White on Black")); | 565 | cm_wb = colorMenu->insertItem(tr( "White on Black")); |
566 | cm_gb = colorMenu->insertItem(tr( "Green on Black")); | 566 | cm_gb = colorMenu->insertItem(tr( "Green on Black")); |
567 | // cm_bt = colorMenu->insertItem(tr( "Black on Transparent")); | 567 | // cm_bt = colorMenu->insertItem(tr( "Black on Transparent")); |
568 | cm_br = colorMenu->insertItem(tr( "Black on Pink")); | 568 | cm_br = colorMenu->insertItem(tr( "Black on Pink")); |
569 | cm_rb = colorMenu->insertItem(tr( "Pink on Black")); | 569 | cm_rb = colorMenu->insertItem(tr( "Pink on Black")); |
570 | cm_gy = colorMenu->insertItem(tr( "Green on Yellow")); | 570 | cm_gy = colorMenu->insertItem(tr( "Green on Yellow")); |
571 | cm_bm = colorMenu->insertItem(tr( "Blue on Magenta")); | 571 | cm_bm = colorMenu->insertItem(tr( "Blue on Magenta")); |
572 | cm_mb = colorMenu->insertItem(tr( "Magenta on Blue")); | 572 | cm_mb = colorMenu->insertItem(tr( "Magenta on Blue")); |
573 | cm_cw = colorMenu->insertItem(tr( "Cyan on White")); | 573 | cm_cw = colorMenu->insertItem(tr( "Cyan on White")); |
574 | cm_wc = colorMenu->insertItem(tr( "White on Cyan")); | 574 | cm_wc = colorMenu->insertItem(tr( "White on Cyan")); |
575 | cm_bb = colorMenu->insertItem(tr( "Blue on Black")); | 575 | cm_bb = colorMenu->insertItem(tr( "Blue on Black")); |
576 | cm_ab = colorMenu->insertItem(tr( "Amber on Black")); | 576 | cm_ab = colorMenu->insertItem(tr( "Amber on Black")); |
577 | cm_default = colorMenu->insertItem(tr("default")); | 577 | cm_default = colorMenu->insertItem(tr("default")); |
578 | 578 | ||
579 | #ifdef QT_QWS_OPIE | 579 | #ifdef QT_QWS_OPIE |
580 | 580 | ||
581 | colorMenu->insertItem(tr( "Custom")); | 581 | colorMenu->insertItem(tr( "Custom")); |
582 | #endif | 582 | #endif |
583 | 583 | ||
584 | configMenu->insertItem(tr( "Colors") ,colorMenu); | 584 | configMenu->insertItem(tr( "Colors") ,colorMenu); |
585 | 585 | ||
586 | sessionList = new QPopupMenu(this); | 586 | sessionList = new QPopupMenu(this); |
587 | sessionList-> insertItem ( Resource::loadPixmap ( "konsole/Terminal" ), tr( "new session" ), this, | 587 | sessionList-> insertItem ( Resource::loadPixmap ( "konsole/Terminal" ), tr( "new session" ), this, |
588 | SLOT(newSession()) ); | 588 | SLOT(newSession()) ); |
589 | 589 | ||
590 | // connect( fontList, SIGNAL( activated(int) ), this, SLOT( fontChanged(int) )); | 590 | // connect( fontList, SIGNAL( activated(int) ), this, SLOT( fontChanged(int) )); |
591 | connect( configMenu, SIGNAL( activated(int) ), this, SLOT( configMenuSelected(int) )); | 591 | connect( configMenu, SIGNAL( activated(int) ), this, SLOT( configMenuSelected(int) )); |
592 | connect( colorMenu, SIGNAL( activated(int) ), this, SLOT( colorMenuIsSelected(int) )); | 592 | connect( colorMenu, SIGNAL( activated(int) ), this, SLOT( colorMenuIsSelected(int) )); |
593 | connect( tabMenu, SIGNAL( activated(int) ), this, SLOT( tabMenuSelected(int) )); | 593 | connect( tabMenu, SIGNAL( activated(int) ), this, SLOT( tabMenuSelected(int) )); |
594 | connect( scrollMenu, SIGNAL(activated(int)),this,SLOT(scrollMenuSelected(int))); | 594 | connect( scrollMenu, SIGNAL(activated(int)),this,SLOT(scrollMenuSelected(int))); |
595 | connect( editCommandListMenu,SIGNAL(activated(int)),this,SLOT(editCommandListMenuSelected(int))); | 595 | connect( editCommandListMenu,SIGNAL(activated(int)),this,SLOT(editCommandListMenuSelected(int))); |
596 | connect( sessionList, SIGNAL(activated(int)), this, SLOT( sessionListSelected(int) ) ); | 596 | connect( sessionList, SIGNAL(activated(int)), this, SLOT( sessionListSelected(int) ) ); |
597 | 597 | ||
598 | menuBar->insertItem( tr("View"), configMenu ); | 598 | menuBar->insertItem( tr("View"), configMenu ); |
599 | menuBar->insertItem( tr("Fonts"), fontList ); | 599 | menuBar->insertItem( tr("Fonts"), fontList ); |
600 | menuBar->insertItem( tr("Sessions"), sessionList ); | 600 | menuBar->insertItem( tr("Sessions"), sessionList ); |
601 | 601 | ||
602 | toolBar = new QToolBar( this ); | 602 | toolBar = new QToolBar( this ); |
603 | 603 | ||
604 | QAction *a; | 604 | QAction *a; |
605 | 605 | ||
606 | // Button Commands | 606 | // Button Commands |
607 | a = new QAction( tr("New"), Resource::loadPixmap( "konsole/Terminal" ), QString::null, 0, this, 0 ); | 607 | a = new QAction( tr("New"), Resource::loadPixmap( "konsole/Terminal" ), QString::null, 0, this, 0 ); |
608 | connect( a, SIGNAL( activated() ), this, SLOT( newSession() ) ); | 608 | connect( a, SIGNAL( activated() ), this, SLOT( newSession() ) ); |
609 | a->addTo( toolBar ); | 609 | a->addTo( toolBar ); |
610 | 610 | ||
611 | a = new QAction( tr("Full Screen"), Resource::loadPixmap( "fullscreen" ), QString::null, 0, this, 0 ); | 611 | a = new QAction( tr("Full Screen"), Resource::loadPixmap( "fullscreen" ), QString::null, 0, this, 0 ); |
612 | connect( a, SIGNAL( activated() ), this, SLOT( toggleFullScreen() ) ); | 612 | connect( a, SIGNAL( activated() ), this, SLOT( toggleFullScreen() ) ); |
613 | a->addTo( toolBar ); | 613 | a->addTo( toolBar ); |
614 | 614 | ||
615 | a = new QAction( tr("Zoom"), Resource::loadPixmap( "zoom" ), QString::null, 0, this, 0 ); | 615 | a = new QAction( tr("Zoom"), Resource::loadPixmap( "zoom" ), QString::null, 0, this, 0 ); |
616 | connect( a, SIGNAL( activated() ), this, SLOT( cycleZoom() ) ); | 616 | connect( a, SIGNAL( activated() ), this, SLOT( cycleZoom() ) ); |
617 | a->addTo( toolBar ); | 617 | a->addTo( toolBar ); |
618 | 618 | ||
619 | 619 | ||
620 | /* | 620 | /* |
621 | a = new QAction( tr("Enter"), Resource::loadPixmap( "konsole/enter" ), QString::null, 0, this, 0 ); | 621 | a = new QAction( tr("Enter"), Resource::loadPixmap( "konsole/enter" ), QString::null, 0, this, 0 ); |
622 | connect( a, SIGNAL( activated() ), this, SLOT( hitEnter() ) ); a->addTo( toolBar ); | 622 | connect( a, SIGNAL( activated() ), this, SLOT( hitEnter() ) ); a->addTo( toolBar ); |
623 | a = new QAction( tr("Space"), Resource::loadPixmap( "konsole/space" ), QString::null, 0, this, 0 ); | 623 | a = new QAction( tr("Space"), Resource::loadPixmap( "konsole/space" ), QString::null, 0, this, 0 ); |
624 | connect( a, SIGNAL( activated() ), this, SLOT( hitSpace() ) ); a->addTo( toolBar ); | 624 | connect( a, SIGNAL( activated() ), this, SLOT( hitSpace() ) ); a->addTo( toolBar ); |
625 | a = new QAction( tr("Tab"), Resource::loadPixmap( "konsole/tab" ), QString::null, 0, this, 0 ); | 625 | a = new QAction( tr("Tab"), Resource::loadPixmap( "konsole/tab" ), QString::null, 0, this, 0 ); |
626 | connect( a, SIGNAL( activated() ), this, SLOT( hitTab() ) ); a->addTo( toolBar ); | 626 | connect( a, SIGNAL( activated() ), this, SLOT( hitTab() ) ); a->addTo( toolBar ); |
627 | */ | 627 | */ |
628 | /* | 628 | /* |
629 | a = new QAction( tr("Up"), Resource::loadPixmap( "konsole/up" ), QString::null, 0, this, 0 ); | 629 | a = new QAction( tr("Up"), Resource::loadPixmap( "konsole/up" ), QString::null, 0, this, 0 ); |
630 | connect( a, SIGNAL( activated() ), this, SLOT( hitUp() ) ); a->addTo( toolBar ); | 630 | connect( a, SIGNAL( activated() ), this, SLOT( hitUp() ) ); a->addTo( toolBar ); |
631 | a = new QAction( tr("Down"), Resource::loadPixmap( "konsole/down" ), QString::null, 0, this, 0 ); | 631 | a = new QAction( tr("Down"), Resource::loadPixmap( "konsole/down" ), QString::null, 0, this, 0 ); |
632 | connect( a, SIGNAL( activated() ), this, SLOT( hitDown() ) ); a->addTo( toolBar ); | 632 | connect( a, SIGNAL( activated() ), this, SLOT( hitDown() ) ); a->addTo( toolBar ); |
633 | */ | 633 | */ |
634 | a = new QAction( tr("Paste"), Resource::loadPixmap( "paste" ), QString::null, 0, this, 0 ); | 634 | a = new QAction( tr("Paste"), Resource::loadPixmap( "paste" ), QString::null, 0, this, 0 ); |
635 | connect( a, SIGNAL( activated() ), this, SLOT( hitPaste() ) ); | 635 | connect( a, SIGNAL( activated() ), this, SLOT( hitPaste() ) ); |
636 | a->addTo( toolBar ); | 636 | a->addTo( toolBar ); |
637 | 637 | ||
638 | secondToolBar = new QToolBar( this ); | 638 | secondToolBar = new QToolBar( this ); |
639 | secondToolBar->setHorizontalStretchable( TRUE ); | 639 | secondToolBar->setHorizontalStretchable( TRUE ); |
640 | 640 | ||
641 | commonCombo = new QComboBox( secondToolBar ); | 641 | commonCombo = new QComboBox( secondToolBar ); |
642 | // commonCombo->setMaximumWidth(236); | 642 | // commonCombo->setMaximumWidth(236); |
643 | 643 | ||
644 | ec_quick = editCommandListMenu->insertItem( tr( "Quick Edit" ) ); | 644 | ec_quick = editCommandListMenu->insertItem( tr( "Quick Edit" ) ); |
645 | if( listHidden) | 645 | if( listHidden) |
646 | { | 646 | { |
647 | secondToolBar->hide(); | 647 | secondToolBar->hide(); |
648 | editCommandListMenu->setItemEnabled(ec_quick ,FALSE); | 648 | editCommandListMenu->setItemEnabled(ec_quick ,FALSE); |
649 | } | 649 | } |
650 | ec_edit = editCommandListMenu->insertItem(tr( "Edit..." ) ); | 650 | ec_edit = editCommandListMenu->insertItem(tr( "Edit..." ) ); |
651 | 651 | ||
652 | cfg.setGroup("Commands"); | 652 | cfg.setGroup("Commands"); |
653 | commonCombo->setInsertionPolicy(QComboBox::AtCurrent); | 653 | commonCombo->setInsertionPolicy(QComboBox::AtCurrent); |
654 | 654 | ||
655 | initCommandList(); | 655 | initCommandList(); |
656 | // for (int i = 0; commonCmds[i] != NULL; i++) { | 656 | // for (int i = 0; commonCmds[i] != NULL; i++) { |
657 | // commonCombo->insertItem( commonCmds[i], i ); | 657 | // commonCombo->insertItem( commonCmds[i], i ); |
658 | // tmp = cfg.readEntry( QString::number(i),""); | 658 | // tmp = cfg.readEntry( QString::number(i),""); |
659 | // if(tmp != "") | 659 | // if(tmp != "") |
660 | // commonCombo->changeItem( tmp,i ); | 660 | // commonCombo->changeItem( tmp,i ); |
661 | // } | 661 | // } |
662 | 662 | ||
663 | connect( commonCombo, SIGNAL( activated(int) ), this, SLOT( enterCommand(int) )); | 663 | connect( commonCombo, SIGNAL( activated(int) ), this, SLOT( enterCommand(int) )); |
664 | 664 | ||
665 | sm_none = scrollMenu->insertItem(tr( "None" )); | 665 | sm_none = scrollMenu->insertItem(tr( "None" )); |
666 | sm_left = scrollMenu->insertItem(tr( "Left" )); | 666 | sm_left = scrollMenu->insertItem(tr( "Left" )); |
667 | sm_right = scrollMenu->insertItem(tr( "Right" )); | 667 | sm_right = scrollMenu->insertItem(tr( "Right" )); |
668 | // scrollMenu->insertSeparator(4); | 668 | // scrollMenu->insertSeparator(4); |
669 | // scrollMenu->insertItem(tr( "Horizontal" )); | 669 | // scrollMenu->insertItem(tr( "Horizontal" )); |
670 | 670 | ||
671 | configMenu->insertItem(tr( "ScrollBar" ),scrollMenu); | 671 | configMenu->insertItem(tr( "ScrollBar" ),scrollMenu); |
672 | 672 | ||
673 | configMenu->insertItem(tr( "History..." ), this, SLOT(historyDialog())); | 673 | configMenu->insertItem(tr( "History..." ), this, SLOT(historyDialog())); |
674 | 674 | ||
675 | cm_wrap = configMenu->insertItem(tr( "Wrap" )); | 675 | cm_wrap = configMenu->insertItem(tr( "Wrap" )); |
676 | cfg.setGroup("ScrollBar"); | 676 | cfg.setGroup("ScrollBar"); |
677 | configMenu->setItemChecked(cm_wrap, cfg.readBoolEntry("HorzScroll",0)); | 677 | configMenu->setItemChecked(cm_wrap, cfg.readBoolEntry("HorzScroll",0)); |
678 | 678 | ||
679 | cm_beep = configMenu->insertItem(tr( "Use Beep" )); | 679 | cm_beep = configMenu->insertItem(tr( "Use Beep" )); |
680 | cfg.setGroup("Menubar"); | 680 | cfg.setGroup("Menubar"); |
681 | configMenu->setItemChecked(cm_beep, cfg.readBoolEntry("useBeep",0)); | 681 | configMenu->setItemChecked(cm_beep, cfg.readBoolEntry("useBeep",0)); |
682 | 682 | ||
683 | fullscreen_msg = new QLabel(this); | 683 | fullscreen_msg = new QLabel(this); |
684 | fullscreen_msg-> setAlignment ( AlignCenter | SingleLine ); | 684 | fullscreen_msg-> setAlignment ( AlignCenter | SingleLine ); |
685 | fullscreen_msg-> hide(); | 685 | fullscreen_msg-> hide(); |
686 | fullscreen_msg-> setSizePolicy ( QSizePolicy ( QSizePolicy::Expanding, QSizePolicy::Expanding )); | 686 | fullscreen_msg-> setSizePolicy ( QSizePolicy ( QSizePolicy::Expanding, QSizePolicy::Expanding )); |
687 | fullscreen_msg-> setAutoResize(true); | 687 | fullscreen_msg-> setAutoResize(true); |
688 | fullscreen_msg-> setFrameStyle(QFrame::PopupPanel | QFrame::Raised); | 688 | fullscreen_msg-> setFrameStyle(QFrame::PopupPanel | QFrame::Raised); |
689 | fullscreen_msg-> setText(tr("To exit fullscreen, tap here.")); | 689 | fullscreen_msg-> setText(tr("To exit fullscreen, tap here.")); |
690 | 690 | ||
691 | fullscreen_timer = new QTimer(this); | 691 | fullscreen_timer = new QTimer(this); |
692 | connect(fullscreen_timer, SIGNAL(timeout()), | 692 | connect(fullscreen_timer, SIGNAL(timeout()), |
693 | this, SLOT(fullscreenTimeout())); | 693 | this, SLOT(fullscreenTimeout())); |
694 | show_fullscreen_msg = true; | 694 | show_fullscreen_msg = true; |
695 | 695 | ||
696 | //scrollMenuSelected(-29); | 696 | //scrollMenuSelected(-29); |
697 | // cfg.setGroup("ScrollBar"); | 697 | // cfg.setGroup("ScrollBar"); |
698 | // if(cfg.readBoolEntry("HorzScroll",0)) { | 698 | // if(cfg.readBoolEntry("HorzScroll",0)) { |
699 | // if(cfg.readNumEntry("Position",2) == 0) | 699 | // if(cfg.readNumEntry("Position",2) == 0) |
700 | // te->setScrollbarLocation(1); | 700 | // te->setScrollbarLocation(1); |
701 | // else | 701 | // else |
702 | // te->setScrollbarLocation(0); | 702 | // te->setScrollbarLocation(0); |
703 | // te->setScrollbarLocation( cfg.readNumEntry("Position",2)); | 703 | // te->setScrollbarLocation( cfg.readNumEntry("Position",2)); |
704 | // te->setWrapAt(120); | 704 | // te->setWrapAt(120); |
705 | // } | 705 | // } |
706 | // create applications ///////////////////////////////////////////////////// | 706 | // create applications ///////////////////////////////////////////////////// |
707 | setCentralWidget(tab); | 707 | setCentralWidget(tab); |
708 | 708 | ||
709 | // load keymaps //////////////////////////////////////////////////////////// | 709 | // load keymaps //////////////////////////////////////////////////////////// |