-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 8b4202d..de00494 100644 --- a/core/apps/embeddedkonsole/konsole.cpp +++ b/core/apps/embeddedkonsole/konsole.cpp | |||
@@ -1,939 +1,939 @@ | |||
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 | #include <opie2/odebug.h> | 32 | #include <opie2/odebug.h> |
33 | using namespace Opie; | 33 | using namespace Opie; |
34 | #endif | 34 | #endif |
35 | 35 | ||
36 | #include <qpe/resource.h> | 36 | #include <qpe/resource.h> |
37 | 37 | ||
38 | #include <qmenubar.h> | 38 | #include <qmenubar.h> |
39 | #include <qtabbar.h> | 39 | #include <qtabbar.h> |
40 | #include <qpe/config.h> | 40 | #include <qpe/config.h> |
41 | #include <qfontdatabase.h> | 41 | #include <qfontdatabase.h> |
42 | #include <qfile.h> | 42 | #include <qfile.h> |
43 | #include <qspinbox.h> | 43 | #include <qspinbox.h> |
44 | #include <qlayout.h> | 44 | #include <qlayout.h> |
45 | 45 | ||
46 | #include <sys/wait.h> | 46 | #include <sys/wait.h> |
47 | #include <stdio.h> | 47 | #include <stdio.h> |
48 | #include <stdlib.h> | 48 | #include <stdlib.h> |
49 | #include <assert.h> | 49 | #include <assert.h> |
50 | 50 | ||
51 | #include "konsole.h" | 51 | #include "konsole.h" |
52 | #include "commandeditdialog.h" | 52 | #include "commandeditdialog.h" |
53 | 53 | ||
54 | class EKNumTabBar : public QTabBar | 54 | class EKNumTabBar : public QTabBar |
55 | { | 55 | { |
56 | public: | 56 | public: |
57 | EKNumTabBar(QWidget *parent = 0, const char *name = 0) : | 57 | EKNumTabBar(QWidget *parent = 0, const char *name = 0) : |
58 | QTabBar(parent, name) | 58 | QTabBar(parent, name) |
59 | {} | 59 | {} |
60 | 60 | ||
61 | // QList<QTab> *getTabList() { return(tabList()); } | 61 | // QList<QTab> *getTabList() { return(tabList()); } |
62 | 62 | ||
63 | void numberTabs() | 63 | void numberTabs() |
64 | { | 64 | { |
65 | // Yes, it really is this messy. QTabWidget needs functions | 65 | // Yes, it really is this messy. QTabWidget needs functions |
66 | // that provide acces to tabs in a sequential way. | 66 | // that provide acces to tabs in a sequential way. |
67 | int m=INT_MIN; | 67 | int m=INT_MIN; |
68 | for (int i=0; i<count(); i++) | 68 | for (int i=0; i<count(); i++) |
69 | { | 69 | { |
70 | QTab* left=0; | 70 | QTab* left=0; |
71 | QListIterator<QTab> it(*tabList()); | 71 | QListIterator<QTab> it(*tabList()); |
72 | int x=INT_MAX; | 72 | int x=INT_MAX; |
73 | for( QTab* t; (t=it.current()); ++it ) | 73 | for( QTab* t; (t=it.current()); ++it ) |
74 | { | 74 | { |
75 | int tx = t->rect().x(); | 75 | int tx = t->rect().x(); |
76 | if ( tx<x && tx>m ) | 76 | if ( tx<x && tx>m ) |
77 | { | 77 | { |
78 | x = tx; | 78 | x = tx; |
79 | left = t; | 79 | left = t; |
80 | } | 80 | } |
81 | } | 81 | } |
82 | if ( left ) | 82 | if ( left ) |
83 | { | 83 | { |
84 | left->setText(QString::number(i+1)); | 84 | left->setText(QString::number(i+1)); |
85 | m = left->rect().x(); | 85 | m = left->rect().x(); |
86 | } | 86 | } |
87 | } | 87 | } |
88 | } | 88 | } |
89 | 89 | ||
90 | virtual QSize sizeHint() const | 90 | virtual QSize sizeHint() const |
91 | { | 91 | { |
92 | if (isHidden()) | 92 | if (isHidden()) |
93 | { | 93 | { |
94 | return(QSize(0,0)); | 94 | return(QSize(0,0)); |
95 | } | 95 | } |
96 | else | 96 | else |
97 | { | 97 | { |
98 | QSize size = QTabBar::sizeHint(); | 98 | QSize size = QTabBar::sizeHint(); |
99 | int shrink = 5; | 99 | int shrink = 5; |
100 | if (qApp->desktop()->width() > 600 || qApp->desktop()->height() > 600) | 100 | if (qApp->desktop()->width() > 600 || qApp->desktop()->height() > 600) |
101 | { | 101 | { |
102 | shrink = 10; | 102 | shrink = 10; |
103 | } | 103 | } |
104 | size.setHeight(size.height() - shrink); | 104 | size.setHeight(size.height() - shrink); |
105 | return(size); | 105 | return(size); |
106 | } | 106 | } |
107 | } | 107 | } |
108 | 108 | ||
109 | }; | 109 | }; |
110 | 110 | ||
111 | class EKNumTabWidget : public QTabWidget | 111 | class EKNumTabWidget : public QTabWidget |
112 | { | 112 | { |
113 | public: | 113 | public: |
114 | EKNumTabWidget(QWidget* parent) : QTabWidget(parent) | 114 | EKNumTabWidget(QWidget* parent) : QTabWidget(parent) |
115 | { | 115 | { |
116 | setTabBar(new EKNumTabBar(parent,"EKTabBar")); | 116 | setTabBar(new EKNumTabBar(parent,"EKTabBar")); |
117 | setSizePolicy( QSizePolicy( QSizePolicy::Expanding, QSizePolicy::Expanding ) ); | 117 | setSizePolicy( QSizePolicy( QSizePolicy::Expanding, QSizePolicy::Expanding ) ); |
118 | } | 118 | } |
119 | 119 | ||
120 | EKNumTabBar *getTabBar() const | 120 | EKNumTabBar *getTabBar() const |
121 | { | 121 | { |
122 | return ((EKNumTabBar*)tabBar()); | 122 | return ((EKNumTabBar*)tabBar()); |
123 | } | 123 | } |
124 | 124 | ||
125 | 125 | ||
126 | void addTab(QWidget* w) | 126 | void addTab(QWidget* w) |
127 | { | 127 | { |
128 | QTab* t = new QTab(QString::number(tabBar()->count()+1)); | 128 | QTab* t = new QTab(QString::number(tabBar()->count()+1)); |
129 | QTabWidget::addTab(w,t); | 129 | QTabWidget::addTab(w,t); |
130 | } | 130 | } |
131 | 131 | ||
132 | void removeTab(QWidget* w) | 132 | void removeTab(QWidget* w) |
133 | { | 133 | { |
134 | removePage(w); | 134 | removePage(w); |
135 | ((EKNumTabBar*)tabBar())->numberTabs(); | 135 | ((EKNumTabBar*)tabBar())->numberTabs(); |
136 | } | 136 | } |
137 | }; | 137 | }; |
138 | 138 | ||
139 | // This could be configurable or dynamicly generated from the bash history | 139 | // This could be configurable or dynamicly generated from the bash history |
140 | // file of the user | 140 | // file of the user |
141 | static const char *commonCmds[] = | 141 | static const char *commonCmds[] = |
142 | { | 142 | { |
143 | "ls ", // I left this here, cause it looks better than the first alpha | 143 | "ls ", // I left this here, cause it looks better than the first alpha |
144 | "cardctl eject", | 144 | "cardctl eject", |
145 | "cat ", | 145 | "cat ", |
146 | "cd ", | 146 | "cd ", |
147 | "chmod ", | 147 | "chmod ", |
148 | "clear", | 148 | "clear", |
149 | "cp ", | 149 | "cp ", |
150 | "dc ", | 150 | "dc ", |
151 | "df ", | 151 | "df ", |
152 | "dmesg", | 152 | "dmesg", |
153 | "echo ", | 153 | "echo ", |
154 | "env", | 154 | "env", |
155 | "find ", | 155 | "find ", |
156 | "free", | 156 | "free", |
157 | "grep ", | 157 | "grep ", |
158 | "ifconfig ", | 158 | "ifconfig ", |
159 | "ipkg ", | 159 | "ipkg ", |
160 | "mkdir ", | 160 | "mkdir ", |
161 | "mv ", | 161 | "mv ", |
162 | "nc localhost 7776", | 162 | "nc localhost 7776", |
163 | "nc localhost 7777", | 163 | "nc localhost 7777", |
164 | "netstat ", | 164 | "netstat ", |
165 | "nslookup ", | 165 | "nslookup ", |
166 | "ping ", | 166 | "ping ", |
167 | "ps aux", | 167 | "ps aux", |
168 | "pwd ", | 168 | "pwd ", |
169 | "qcop QPE/System 'linkChanged(QString)' ''", | 169 | // "qcop QPE/System 'linkChanged(QString)' ''", |
170 | "qcop QPE/System 'restart()'", | 170 | // "qcop QPE/System 'restart()'", |
171 | "qcop QPE/System 'quit()'", | 171 | // "qcop QPE/System 'quit()'", |
172 | "rm ", | 172 | "rm ", |
173 | "rmdir ", | 173 | "rmdir ", |
174 | "route ", | 174 | "route ", |
175 | "set ", | 175 | "set ", |
176 | "traceroute", | 176 | "traceroute", |
177 | 177 | ||
178 | /* | 178 | /* |
179 | "gzip", | 179 | "gzip", |
180 | "gunzip", | 180 | "gunzip", |
181 | "chgrp", | 181 | "chgrp", |
182 | "chown", | 182 | "chown", |
183 | "date", | 183 | "date", |
184 | "dd", | 184 | "dd", |
185 | "df", | 185 | "df", |
186 | "dmesg", | 186 | "dmesg", |
187 | "fuser", | 187 | "fuser", |
188 | "hostname", | 188 | "hostname", |
189 | "kill", | 189 | "kill", |
190 | "killall", | 190 | "killall", |
191 | "ln", | 191 | "ln", |
192 | "ping", | 192 | "ping", |
193 | "mount", | 193 | "mount", |
194 | "more", | 194 | "more", |
195 | "sort", | 195 | "sort", |
196 | "touch", | 196 | "touch", |
197 | "umount", | 197 | "umount", |
198 | "mknod", | 198 | "mknod", |
199 | "netstat", | 199 | "netstat", |
200 | */ | 200 | */ |
201 | 201 | ||
202 | "exit", | 202 | "exit", |
203 | NULL | 203 | NULL |
204 | }; | 204 | }; |
205 | 205 | ||
206 | 206 | ||
207 | static void konsoleInit(const char** shell) { | 207 | static void konsoleInit(const char** shell) { |
208 | if(setuid(getuid()) !=0) odebug << "setuid failed" << oendl; | 208 | if(setuid(getuid()) !=0) odebug << "setuid failed" << oendl; |
209 | if(setgid(getgid()) != 0) odebug << "setgid failed" << oendl; // drop privileges | 209 | if(setgid(getgid()) != 0) odebug << "setgid failed" << oendl; // drop privileges |
210 | 210 | ||
211 | 211 | ||
212 | // QPEApplication::grabKeyboard(); // for CTRL and ALT | 212 | // QPEApplication::grabKeyboard(); // for CTRL and ALT |
213 | 213 | ||
214 | odebug << "keyboard grabbed" << oendl; | 214 | odebug << "keyboard grabbed" << oendl; |
215 | #ifdef FAKE_CTRL_AND_ALT | 215 | #ifdef FAKE_CTRL_AND_ALT |
216 | odebug << "Fake Ctrl and Alt defined" << oendl; | 216 | odebug << "Fake Ctrl and Alt defined" << oendl; |
217 | QPEApplication::grabKeyboard(); // for CTRL and ALT | 217 | QPEApplication::grabKeyboard(); // for CTRL and ALT |
218 | #endif | 218 | #endif |
219 | 219 | ||
220 | *shell = getenv("SHELL"); | 220 | *shell = getenv("SHELL"); |
221 | owarn << "SHell initially is " << *shell << "" << oendl; | 221 | owarn << "SHell initially is " << *shell << "" << oendl; |
222 | 222 | ||
223 | if (shell == NULL || *shell == '\0') { | 223 | if (shell == NULL || *shell == '\0') { |
224 | struct passwd *ent = 0; | 224 | struct passwd *ent = 0; |
225 | uid_t me = getuid(); | 225 | uid_t me = getuid(); |
226 | *shell = "/bin/sh"; | 226 | *shell = "/bin/sh"; |
227 | 227 | ||
228 | while ( (ent = getpwent()) != 0 ) { | 228 | while ( (ent = getpwent()) != 0 ) { |
229 | if (ent->pw_uid == me) { | 229 | if (ent->pw_uid == me) { |
230 | if (ent->pw_shell != "") | 230 | if (ent->pw_shell != "") |
231 | *shell = ent->pw_shell; | 231 | *shell = ent->pw_shell; |
232 | break; | 232 | break; |
233 | } | 233 | } |
234 | } | 234 | } |
235 | endpwent(); | 235 | endpwent(); |
236 | } | 236 | } |
237 | 237 | ||
238 | if( putenv((char*)"COLORTERM=") !=0) | 238 | if( putenv((char*)"COLORTERM=") !=0) |
239 | odebug << "putenv failed" << oendl; // to trigger mc's color detection | 239 | odebug << "putenv failed" << oendl; // to trigger mc's color detection |
240 | } | 240 | } |
241 | 241 | ||
242 | 242 | ||
243 | Konsole::Konsole(QWidget* parent, const char* name, WFlags fl) : | 243 | Konsole::Konsole(QWidget* parent, const char* name, WFlags fl) : |
244 | QMainWindow(parent, name, fl) | 244 | QMainWindow(parent, name, fl) |
245 | { | 245 | { |
246 | QStrList tmp; const char* shell; | 246 | QStrList tmp; const char* shell; |
247 | 247 | ||
248 | konsoleInit( &shell); | 248 | konsoleInit( &shell); |
249 | init(shell,tmp); | 249 | init(shell,tmp); |
250 | } | 250 | } |
251 | 251 | ||
252 | Konsole::Konsole(const char* name, const char* _pgm, QStrList & _args, int) | 252 | Konsole::Konsole(const char* name, const char* _pgm, QStrList & _args, int) |
253 | : QMainWindow(0, name) | 253 | : QMainWindow(0, name) |
254 | { | 254 | { |
255 | init(_pgm,_args); | 255 | init(_pgm,_args); |
256 | } | 256 | } |
257 | 257 | ||
258 | struct HistoryItem | 258 | struct HistoryItem |
259 | { | 259 | { |
260 | HistoryItem(int c, const QString &l) | 260 | HistoryItem(int c, const QString &l) |
261 | { | 261 | { |
262 | count = c; | 262 | count = c; |
263 | line = l; | 263 | line = l; |
264 | } | 264 | } |
265 | int count; | 265 | int count; |
266 | QString line; | 266 | QString line; |
267 | }; | 267 | }; |
268 | 268 | ||
269 | class HistoryList : public QList<HistoryItem> | 269 | class HistoryList : public QList<HistoryItem> |
270 | { | 270 | { |
271 | virtual int compareItems( QCollection::Item item1, QCollection::Item item2) | 271 | virtual int compareItems( QCollection::Item item1, QCollection::Item item2) |
272 | { | 272 | { |
273 | int c1 = ((HistoryItem*)item1)->count; | 273 | int c1 = ((HistoryItem*)item1)->count; |
274 | int c2 = ((HistoryItem*)item2)->count; | 274 | int c2 = ((HistoryItem*)item2)->count; |
275 | if (c1 > c2) | 275 | if (c1 > c2) |
276 | return(1); | 276 | return(1); |
277 | if (c1 < c2) | 277 | if (c1 < c2) |
278 | return(-1); | 278 | return(-1); |
279 | return(0); | 279 | return(0); |
280 | } | 280 | } |
281 | }; | 281 | }; |
282 | 282 | ||
283 | void Konsole::initCommandList() | 283 | void Konsole::initCommandList() |
284 | { | 284 | { |
285 | // odebug << "Konsole::initCommandList" << oendl; | 285 | // odebug << "Konsole::initCommandList" << oendl; |
286 | Config cfg( "Konsole" ); | 286 | Config cfg( "Konsole" ); |
287 | cfg.setGroup("Commands"); | 287 | cfg.setGroup("Commands"); |
288 | // commonCombo->setInsertionPolicy(QComboBox::AtCurrent); | 288 | // commonCombo->setInsertionPolicy(QComboBox::AtCurrent); |
289 | commonCombo->clear(); | 289 | commonCombo->clear(); |
290 | 290 | ||
291 | if (cfg.readEntry("ShellHistory","TRUE") == "FALSE") { | 291 | if (cfg.readEntry("ShellHistory","TRUE") == "FALSE") { |
292 | QString histfilename = QString(getenv("HOME")) + "/.bash_history"; | 292 | QString histfilename = QString(getenv("HOME")) + "/.bash_history"; |
293 | histfilename = cfg.readEntry("ShellHistoryPath",histfilename); | 293 | histfilename = cfg.readEntry("ShellHistoryPath",histfilename); |
294 | QFile histfile(histfilename); | 294 | QFile histfile(histfilename); |
295 | // note: compiler barfed on: | 295 | // note: compiler barfed on: |
296 | // QFile histfile(QString(getenv("HOME")) + "/.bash_history"); | 296 | // QFile histfile(QString(getenv("HOME")) + "/.bash_history"); |
297 | if (histfile.open( IO_ReadOnly )) { | 297 | if (histfile.open( IO_ReadOnly )) { |
298 | QString line; | 298 | QString line; |
299 | uint i; | 299 | uint i; |
300 | HistoryList items; | 300 | HistoryList items; |
301 | 301 | ||
302 | int lineno = 0; | 302 | int lineno = 0; |
303 | while(!histfile.atEnd()) { | 303 | while(!histfile.atEnd()) { |
304 | if (histfile.readLine(line, 200) < 0) { | 304 | if (histfile.readLine(line, 200) < 0) { |
305 | break; | 305 | break; |
306 | } | 306 | } |
307 | line = line.left(line.length()-1); | 307 | line = line.left(line.length()-1); |
308 | lineno++; | 308 | lineno++; |
309 | 309 | ||
310 | for(i=0; i<items.count(); i++) { | 310 | for(i=0; i<items.count(); i++) { |
311 | if (line == items.at(i)->line) { | 311 | if (line == items.at(i)->line) { |
312 | // weight recent commands & repeated commands more | 312 | // weight recent commands & repeated commands more |
313 | // by adding up the index of each command | 313 | // by adding up the index of each command |
314 | items.at(i)->count += lineno; | 314 | items.at(i)->count += lineno; |
315 | break; | 315 | break; |
316 | } | 316 | } |
317 | } | 317 | } |
318 | if (i >= items.count()) { | 318 | if (i >= items.count()) { |
319 | items.append(new HistoryItem(lineno, line)); | 319 | items.append(new HistoryItem(lineno, line)); |
320 | } | 320 | } |
321 | } | 321 | } |
322 | items.sort(); | 322 | items.sort(); |
323 | int n = items.count(); | 323 | int n = items.count(); |
324 | if (n > 40) { | 324 | if (n > 40) { |
325 | n = 40; | 325 | n = 40; |
326 | } | 326 | } |
327 | for(int i=0; i<n; i++) { | 327 | for(int i=0; i<n; i++) { |
328 | // should insert start of command, but keep whole thing | 328 | // should insert start of command, but keep whole thing |
329 | if (items.at(items.count()-i-1)->line.length() < 30) { | 329 | if (items.at(items.count()-i-1)->line.length() < 30) { |
330 | commonCombo->insertItem(items.at(items.count()-i-1)->line); | 330 | commonCombo->insertItem(items.at(items.count()-i-1)->line); |
331 | } | 331 | } |
332 | } | 332 | } |
333 | histfile.close(); | 333 | histfile.close(); |
334 | } | 334 | } |
335 | } | 335 | } |
336 | if (cfg.readEntry("Commands Set","FALSE") == "FALSE") { | 336 | if (cfg.readEntry("Commands Set","FALSE") == "FALSE") { |
337 | for (int i = 0; commonCmds[i] != NULL; i++) { | 337 | for (int i = 0; commonCmds[i] != NULL; i++) { |
338 | commonCombo->insertItem(commonCmds[i]); | 338 | commonCombo->insertItem(commonCmds[i]); |
339 | } | 339 | } |
340 | } else { | 340 | } else { |
341 | for (int i = 0; i < 100; i++) { | 341 | for (int i = 0; i < 100; i++) { |
342 | if (!(cfg.readEntry( QString::number(i),"")).isEmpty()) | 342 | if (!(cfg.readEntry( QString::number(i),"")).isEmpty()) |
343 | commonCombo->insertItem(cfg.readEntry( QString::number(i),"")); | 343 | commonCombo->insertItem(cfg.readEntry( QString::number(i),"")); |
344 | } | 344 | } |
345 | } | 345 | } |
346 | 346 | ||
347 | 347 | ||
348 | } | 348 | } |
349 | 349 | ||
350 | static void sig_handler(int x) | 350 | static void sig_handler(int x) |
351 | { | 351 | { |
352 | printf("got signal %d\n",x); | 352 | printf("got signal %d\n",x); |
353 | } | 353 | } |
354 | 354 | ||
355 | void Konsole::init(const char* _pgm, QStrList & _args) | 355 | void Konsole::init(const char* _pgm, QStrList & _args) |
356 | { | 356 | { |
357 | 357 | ||
358 | #if 0 | 358 | #if 0 |
359 | for(int i=1; i<=31; i++) | 359 | for(int i=1; i<=31; i++) |
360 | { | 360 | { |
361 | if (i != SIGPIPE && i != SIGPROF && i != SIGSEGV | 361 | if (i != SIGPIPE && i != SIGPROF && i != SIGSEGV |
362 | && i != SIGINT && i != SIGILL && i != SIGTERM | 362 | && i != SIGINT && i != SIGILL && i != SIGTERM |
363 | && i != SIGBUS) | 363 | && i != SIGBUS) |
364 | signal(i,sig_handler); | 364 | signal(i,sig_handler); |
365 | } | 365 | } |
366 | #endif | 366 | #endif |
367 | signal(SIGSTOP, sig_handler); | 367 | signal(SIGSTOP, sig_handler); |
368 | signal(SIGCONT, sig_handler); | 368 | signal(SIGCONT, sig_handler); |
369 | signal(SIGTSTP, sig_handler); | 369 | signal(SIGTSTP, sig_handler); |
370 | 370 | ||
371 | b_scroll = TRUE; // histon; | 371 | b_scroll = TRUE; // histon; |
372 | n_keytab = 0; | 372 | n_keytab = 0; |
373 | n_render = 0; | 373 | n_render = 0; |
374 | startUp=0; | 374 | startUp=0; |
375 | fromMenu = FALSE; | 375 | fromMenu = FALSE; |
376 | fullscreen = false; | 376 | fullscreen = false; |
377 | 377 | ||
378 | setCaption( tr( "Konsole" ) ); | 378 | setCaption( tr( "Konsole" ) ); |
379 | setIcon( Resource::loadPixmap( "konsole/Terminal" ) ); | 379 | setIcon( Resource::loadPixmap( "konsole/Terminal" ) ); |
380 | 380 | ||
381 | Config cfg( "Konsole" ); | 381 | Config cfg( "Konsole" ); |
382 | cfg.setGroup("Font"); | 382 | cfg.setGroup("Font"); |
383 | QString tmp; | 383 | QString tmp; |
384 | 384 | ||
385 | // initialize the list of allowed fonts /////////////////////////////////// | 385 | // initialize the list of allowed fonts /////////////////////////////////// |
386 | 386 | ||
387 | QString cfgFontName = cfg.readEntry("FontName","Lcfont"); | 387 | QString cfgFontName = cfg.readEntry("FontName","Lcfont"); |
388 | int cfgFontSize = cfg.readNumEntry("FontSize",18); | 388 | int cfgFontSize = cfg.readNumEntry("FontSize",18); |
389 | 389 | ||
390 | cfont = -1; | 390 | cfont = -1; |
391 | 391 | ||
392 | // this code causes repeated access to all the font files | 392 | // this code causes repeated access to all the font files |
393 | // which does slow down startup | 393 | // which does slow down startup |
394 | QFontDatabase fontDB; | 394 | QFontDatabase fontDB; |
395 | QStringList familyNames; | 395 | QStringList familyNames; |
396 | familyNames = fontDB.families( FALSE ); | 396 | familyNames = fontDB.families( FALSE ); |
397 | QString s; | 397 | QString s; |
398 | int fontIndex = 0; | 398 | int fontIndex = 0; |
399 | int familyNum = 0; | 399 | int familyNum = 0; |
400 | fontList = new QPopupMenu( this ); | 400 | fontList = new QPopupMenu( this ); |
401 | 401 | ||
402 | for(uint j = 0; j < (uint)familyNames.count(); j++) | 402 | for(uint j = 0; j < (uint)familyNames.count(); j++) |
403 | { | 403 | { |
404 | s = familyNames[j]; | 404 | s = familyNames[j]; |
405 | if ( s.contains('-') ) | 405 | if ( s.contains('-') ) |
406 | { | 406 | { |
407 | int i = s.find('-'); | 407 | int i = s.find('-'); |
408 | s = s.right( s.length() - i - 1 ) + " [" + s.left( i ) + "]"; | 408 | s = s.right( s.length() - i - 1 ) + " [" + s.left( i ) + "]"; |
409 | } | 409 | } |
410 | s[0] = s[0].upper(); | 410 | s[0] = s[0].upper(); |
411 | 411 | ||
412 | QValueList<int> sizes = fontDB.pointSizes( familyNames[j] ); | 412 | QValueList<int> sizes = fontDB.pointSizes( familyNames[j] ); |
413 | 413 | ||
414 | printf("family[%d] = %s with %d sizes\n", j, familyNames[j].latin1(), | 414 | printf("family[%d] = %s with %d sizes\n", j, familyNames[j].latin1(), |
415 | sizes.count()); | 415 | sizes.count()); |
416 | 416 | ||
417 | if (sizes.count() > 0) | 417 | if (sizes.count() > 0) |
418 | { | 418 | { |
419 | QPopupMenu *sizeMenu; | 419 | QPopupMenu *sizeMenu; |
420 | QFont f; | 420 | QFont f; |
421 | int last_width = -1; | 421 | int last_width = -1; |
422 | sizeMenu = NULL; | 422 | sizeMenu = NULL; |
423 | 423 | ||
424 | for(uint i = 0; i < (uint)sizes.count() + 4; i++) | 424 | for(uint i = 0; i < (uint)sizes.count() + 4; i++) |
425 | { | 425 | { |
426 | // printf("family %s size %d ", familyNames[j].latin1(), sizes[i]); | 426 | // printf("family %s size %d ", familyNames[j].latin1(), sizes[i]); |
427 | // need to divide by 10 on the Z, but not otherwise | 427 | // need to divide by 10 on the Z, but not otherwise |
428 | int size; | 428 | int size; |
429 | 429 | ||
430 | if (i >= (uint)sizes.count()) | 430 | if (i >= (uint)sizes.count()) |
431 | { | 431 | { |
432 | // try for expandable fonts | 432 | // try for expandable fonts |
433 | size = sizes[sizes.count()-1] + 2 * (i - sizes.count() + 1); | 433 | size = sizes[sizes.count()-1] + 2 * (i - sizes.count() + 1); |
434 | } | 434 | } |
435 | else | 435 | else |
436 | { | 436 | { |
437 | printf("sizes[%d] = %d\n", i, sizes[i]); | 437 | printf("sizes[%d] = %d\n", i, sizes[i]); |
438 | size = sizes[i]; | 438 | size = sizes[i]; |
439 | } | 439 | } |
440 | 440 | ||
441 | f = QFont(familyNames[j], size); | 441 | f = QFont(familyNames[j], size); |
442 | f.setFixedPitch(true); | 442 | f.setFixedPitch(true); |
443 | QFontMetrics fm(f); | 443 | QFontMetrics fm(f); |
444 | // don't trust f.fixedPitch() or f.exactMatch(), they lie!! | 444 | // don't trust f.fixedPitch() or f.exactMatch(), they lie!! |
445 | if (fm.width("l") == fm.width("m") | 445 | if (fm.width("l") == fm.width("m") |
446 | && (i < (uint)sizes.count() | 446 | && (i < (uint)sizes.count() |
447 | || fm.width("m") > last_width)) | 447 | || fm.width("m") > last_width)) |
448 | { | 448 | { |
449 | if (i < (uint)sizes.count()) | 449 | if (i < (uint)sizes.count()) |
450 | { | 450 | { |
451 | last_width = fm.width("m"); | 451 | last_width = fm.width("m"); |
452 | } | 452 | } |
453 | if (sizeMenu == NULL) | 453 | if (sizeMenu == NULL) |
454 | { | 454 | { |
455 | sizeMenu = new QPopupMenu(); | 455 | sizeMenu = new QPopupMenu(); |
456 | } | 456 | } |
457 | int id = sizeMenu->insertItem(QString("%1").arg(size), fontIndex); | 457 | int id = sizeMenu->insertItem(QString("%1").arg(size), fontIndex); |
458 | sizeMenu->setItemParameter(id, fontIndex); | 458 | sizeMenu->setItemParameter(id, fontIndex); |
459 | sizeMenu->connectItem(id, this, SLOT(setFont(int))); | 459 | sizeMenu->connectItem(id, this, SLOT(setFont(int))); |
460 | QString name = s + " " + QString::number(size); | 460 | QString name = s + " " + QString::number(size); |
461 | fonts.append(new VTFont(name, f, familyNames[j], familyNum, size)); | 461 | fonts.append(new VTFont(name, f, familyNames[j], familyNum, size)); |
462 | if (familyNames[j] == cfgFontName && size == cfgFontSize) | 462 | if (familyNames[j] == cfgFontName && size == cfgFontSize) |
463 | { | 463 | { |
464 | cfont = fontIndex; | 464 | cfont = fontIndex; |
465 | } | 465 | } |
466 | printf("FOUND: %s family %s size %d\n", name.latin1(), familyNames[j].latin1(), size); | 466 | printf("FOUND: %s family %s size %d\n", name.latin1(), familyNames[j].latin1(), size); |
467 | fontIndex++; | 467 | fontIndex++; |
468 | } | 468 | } |
469 | } | 469 | } |
470 | if (sizeMenu) | 470 | if (sizeMenu) |
471 | { | 471 | { |
472 | fontList->insertItem(s, sizeMenu, familyNum + 1000); | 472 | fontList->insertItem(s, sizeMenu, familyNum + 1000); |
473 | 473 | ||
474 | familyNum++; | 474 | familyNum++; |
475 | } | 475 | } |
476 | } | 476 | } |
477 | 477 | ||
478 | } | 478 | } |
479 | 479 | ||
480 | if (cfont < 0 || cfont >= (int)fonts.count()) | 480 | if (cfont < 0 || cfont >= (int)fonts.count()) |
481 | { | 481 | { |
482 | cfont = 0; | 482 | cfont = 0; |
483 | } | 483 | } |
484 | 484 | ||
485 | // create terminal emulation framework //////////////////////////////////// | 485 | // create terminal emulation framework //////////////////////////////////// |
486 | nsessions = 0; | 486 | nsessions = 0; |
487 | 487 | ||
488 | tab = new EKNumTabWidget(this); | 488 | tab = new EKNumTabWidget(this); |
489 | // tab->setMargin(tab->margin()-5); | 489 | // tab->setMargin(tab->margin()-5); |
490 | connect(tab, SIGNAL(currentChanged(QWidget*)), this, SLOT(switchSession(QWidget*))); | 490 | connect(tab, SIGNAL(currentChanged(QWidget*)), this, SLOT(switchSession(QWidget*))); |
491 | 491 | ||
492 | // create terminal toolbar //////////////////////////////////////////////// | 492 | // create terminal toolbar //////////////////////////////////////////////// |
493 | setToolBarsMovable( FALSE ); | 493 | setToolBarsMovable( FALSE ); |
494 | menuToolBar = new QToolBar( this ); | 494 | menuToolBar = new QToolBar( this ); |
495 | menuToolBar->setHorizontalStretchable( TRUE ); | 495 | menuToolBar->setHorizontalStretchable( TRUE ); |
496 | 496 | ||
497 | QMenuBar *menuBar = new QMenuBar( menuToolBar ); | 497 | QMenuBar *menuBar = new QMenuBar( menuToolBar ); |
498 | 498 | ||
499 | setFont(cfont); | 499 | setFont(cfont); |
500 | 500 | ||
501 | configMenu = new QPopupMenu( this); | 501 | configMenu = new QPopupMenu( this); |
502 | colorMenu = new QPopupMenu( this); | 502 | colorMenu = new QPopupMenu( this); |
503 | scrollMenu = new QPopupMenu( this); | 503 | scrollMenu = new QPopupMenu( this); |
504 | editCommandListMenu = new QPopupMenu( this); | 504 | editCommandListMenu = new QPopupMenu( this); |
505 | 505 | ||
506 | configMenu->insertItem(tr("Command List"), editCommandListMenu); | 506 | configMenu->insertItem(tr("Command List"), editCommandListMenu); |
507 | 507 | ||
508 | bool listHidden; | 508 | bool listHidden; |
509 | cfg.setGroup("Menubar"); | 509 | cfg.setGroup("Menubar"); |
510 | if( cfg.readEntry("Hidden","FALSE") == "TRUE") | 510 | if( cfg.readEntry("Hidden","FALSE") == "TRUE") |
511 | { | 511 | { |
512 | ec_cmdlist = editCommandListMenu->insertItem( tr( "Show command list" )); | 512 | ec_cmdlist = editCommandListMenu->insertItem( tr( "Show command list" )); |
513 | listHidden=TRUE; | 513 | listHidden=TRUE; |
514 | } | 514 | } |
515 | else | 515 | else |
516 | { | 516 | { |
517 | ec_cmdlist = editCommandListMenu->insertItem( tr( "Hide command list" )); | 517 | ec_cmdlist = editCommandListMenu->insertItem( tr( "Hide command list" )); |
518 | listHidden=FALSE; | 518 | listHidden=FALSE; |
519 | } | 519 | } |
520 | 520 | ||
521 | cfg.setGroup("Tabs"); | 521 | cfg.setGroup("Tabs"); |
522 | 522 | ||
523 | tabMenu = new QPopupMenu(this); | 523 | tabMenu = new QPopupMenu(this); |
524 | tm_bottom = tabMenu->insertItem(tr("Bottom" )); | 524 | tm_bottom = tabMenu->insertItem(tr("Bottom" )); |
525 | tm_top = tabMenu->insertItem(tr("Top")); | 525 | tm_top = tabMenu->insertItem(tr("Top")); |
526 | tm_hidden = tabMenu->insertItem(tr("Hidden")); | 526 | tm_hidden = tabMenu->insertItem(tr("Hidden")); |
527 | 527 | ||
528 | configMenu->insertItem(tr("Tabs"), tabMenu); | 528 | configMenu->insertItem(tr("Tabs"), tabMenu); |
529 | 529 | ||
530 | tmp=cfg.readEntry("Position","Top"); | 530 | tmp=cfg.readEntry("Position","Top"); |
531 | if(tmp=="Top") | 531 | if(tmp=="Top") |
532 | { | 532 | { |
533 | tab->setTabPosition(QTabWidget::Top); | 533 | tab->setTabPosition(QTabWidget::Top); |
534 | tab->getTabBar()->show(); | 534 | tab->getTabBar()->show(); |
535 | tabPos = tm_top; | 535 | tabPos = tm_top; |
536 | } | 536 | } |
537 | else if (tmp=="Bottom") | 537 | else if (tmp=="Bottom") |
538 | { | 538 | { |
539 | tab->setTabPosition(QTabWidget::Bottom); | 539 | tab->setTabPosition(QTabWidget::Bottom); |
540 | tab->getTabBar()->show(); | 540 | tab->getTabBar()->show(); |
541 | tabPos = tm_bottom; | 541 | tabPos = tm_bottom; |
542 | } | 542 | } |
543 | else | 543 | else |
544 | { | 544 | { |
545 | tab->getTabBar()->hide(); | 545 | tab->getTabBar()->hide(); |
546 | tab->setMargin(tab->margin()); | 546 | tab->setMargin(tab->margin()); |
547 | tabPos = tm_hidden; | 547 | tabPos = tm_hidden; |
548 | } | 548 | } |
549 | 549 | ||
550 | cm_bw = colorMenu->insertItem(tr( "Black on White")); | 550 | cm_bw = colorMenu->insertItem(tr( "Black on White")); |
551 | cm_wb = colorMenu->insertItem(tr( "White on Black")); | 551 | cm_wb = colorMenu->insertItem(tr( "White on Black")); |
552 | cm_gb = colorMenu->insertItem(tr( "Green on Black")); | 552 | cm_gb = colorMenu->insertItem(tr( "Green on Black")); |
553 | // cm_bt = colorMenu->insertItem(tr( "Black on Transparent")); | 553 | // cm_bt = colorMenu->insertItem(tr( "Black on Transparent")); |
554 | cm_br = colorMenu->insertItem(tr( "Black on Pink")); | 554 | cm_br = colorMenu->insertItem(tr( "Black on Pink")); |
555 | cm_rb = colorMenu->insertItem(tr( "Pink on Black")); | 555 | cm_rb = colorMenu->insertItem(tr( "Pink on Black")); |
556 | cm_gy = colorMenu->insertItem(tr( "Green on Yellow")); | 556 | cm_gy = colorMenu->insertItem(tr( "Green on Yellow")); |
557 | cm_bm = colorMenu->insertItem(tr( "Blue on Magenta")); | 557 | cm_bm = colorMenu->insertItem(tr( "Blue on Magenta")); |
558 | cm_mb = colorMenu->insertItem(tr( "Magenta on Blue")); | 558 | cm_mb = colorMenu->insertItem(tr( "Magenta on Blue")); |
559 | cm_cw = colorMenu->insertItem(tr( "Cyan on White")); | 559 | cm_cw = colorMenu->insertItem(tr( "Cyan on White")); |
560 | cm_wc = colorMenu->insertItem(tr( "White on Cyan")); | 560 | cm_wc = colorMenu->insertItem(tr( "White on Cyan")); |
561 | cm_bb = colorMenu->insertItem(tr( "Blue on Black")); | 561 | cm_bb = colorMenu->insertItem(tr( "Blue on Black")); |
562 | cm_ab = colorMenu->insertItem(tr( "Amber on Black")); | 562 | cm_ab = colorMenu->insertItem(tr( "Amber on Black")); |
563 | cm_default = colorMenu->insertItem(tr("default")); | 563 | cm_default = colorMenu->insertItem(tr("default")); |
564 | 564 | ||
565 | #ifdef QT_QWS_OPIE | 565 | #ifdef QT_QWS_OPIE |
566 | 566 | ||
567 | colorMenu->insertItem(tr( "Custom")); | 567 | colorMenu->insertItem(tr( "Custom")); |
568 | #endif | 568 | #endif |
569 | 569 | ||
570 | configMenu->insertItem(tr( "Colors") ,colorMenu); | 570 | configMenu->insertItem(tr( "Colors") ,colorMenu); |
571 | 571 | ||
572 | sessionList = new QPopupMenu(this); | 572 | sessionList = new QPopupMenu(this); |
573 | sessionList-> insertItem ( Resource::loadPixmap ( "konsole/Terminal" ), tr( "new session" ), this, | 573 | sessionList-> insertItem ( Resource::loadPixmap ( "konsole/Terminal" ), tr( "new session" ), this, |
574 | SLOT(newSession()) ); | 574 | SLOT(newSession()) ); |
575 | 575 | ||
576 | // connect( fontList, SIGNAL( activated(int) ), this, SLOT( fontChanged(int) )); | 576 | // connect( fontList, SIGNAL( activated(int) ), this, SLOT( fontChanged(int) )); |
577 | connect( configMenu, SIGNAL( activated(int) ), this, SLOT( configMenuSelected(int) )); | 577 | connect( configMenu, SIGNAL( activated(int) ), this, SLOT( configMenuSelected(int) )); |
578 | connect( colorMenu, SIGNAL( activated(int) ), this, SLOT( colorMenuIsSelected(int) )); | 578 | connect( colorMenu, SIGNAL( activated(int) ), this, SLOT( colorMenuIsSelected(int) )); |
579 | connect( tabMenu, SIGNAL( activated(int) ), this, SLOT( tabMenuSelected(int) )); | 579 | connect( tabMenu, SIGNAL( activated(int) ), this, SLOT( tabMenuSelected(int) )); |
580 | connect( scrollMenu, SIGNAL(activated(int)),this,SLOT(scrollMenuSelected(int))); | 580 | connect( scrollMenu, SIGNAL(activated(int)),this,SLOT(scrollMenuSelected(int))); |
581 | connect( editCommandListMenu,SIGNAL(activated(int)),this,SLOT(editCommandListMenuSelected(int))); | 581 | connect( editCommandListMenu,SIGNAL(activated(int)),this,SLOT(editCommandListMenuSelected(int))); |
582 | connect( sessionList, SIGNAL(activated(int)), this, SLOT( sessionListSelected(int) ) ); | 582 | connect( sessionList, SIGNAL(activated(int)), this, SLOT( sessionListSelected(int) ) ); |
583 | 583 | ||
584 | menuBar->insertItem( tr("View"), configMenu ); | 584 | menuBar->insertItem( tr("View"), configMenu ); |
585 | menuBar->insertItem( tr("Fonts"), fontList ); | 585 | menuBar->insertItem( tr("Fonts"), fontList ); |
586 | menuBar->insertItem( tr("Sessions"), sessionList ); | 586 | menuBar->insertItem( tr("Sessions"), sessionList ); |
587 | 587 | ||
588 | toolBar = new QToolBar( this ); | 588 | toolBar = new QToolBar( this ); |
589 | 589 | ||
590 | QAction *a; | 590 | QAction *a; |
591 | 591 | ||
592 | // Button Commands | 592 | // Button Commands |
593 | a = new QAction( tr("New"), Resource::loadPixmap( "konsole/konsole" ), QString::null, 0, this, 0 ); | 593 | a = new QAction( tr("New"), Resource::loadPixmap( "konsole/konsole" ), QString::null, 0, this, 0 ); |
594 | connect( a, SIGNAL( activated() ), this, SLOT( newSession() ) ); | 594 | connect( a, SIGNAL( activated() ), this, SLOT( newSession() ) ); |
595 | a->addTo( toolBar ); | 595 | a->addTo( toolBar ); |
596 | 596 | ||
597 | a = new QAction( tr("Full Screen"), Resource::loadPixmap( "fullscreen" ), QString::null, 0, this, 0 ); | 597 | a = new QAction( tr("Full Screen"), Resource::loadPixmap( "fullscreen" ), QString::null, 0, this, 0 ); |
598 | connect( a, SIGNAL( activated() ), this, SLOT( toggleFullScreen() ) ); | 598 | connect( a, SIGNAL( activated() ), this, SLOT( toggleFullScreen() ) ); |
599 | a->addTo( toolBar ); | 599 | a->addTo( toolBar ); |
600 | 600 | ||
601 | a = new QAction( tr("Zoom"), Resource::loadPixmap( "zoom" ), QString::null, 0, this, 0 ); | 601 | a = new QAction( tr("Zoom"), Resource::loadPixmap( "zoom" ), QString::null, 0, this, 0 ); |
602 | connect( a, SIGNAL( activated() ), this, SLOT( cycleZoom() ) ); | 602 | connect( a, SIGNAL( activated() ), this, SLOT( cycleZoom() ) ); |
603 | a->addTo( toolBar ); | 603 | a->addTo( toolBar ); |
604 | 604 | ||
605 | 605 | ||
606 | a = new QAction( tr("Enter"), Resource::loadPixmap( "konsole/enter" ), QString::null, 0, this, 0 ); | 606 | a = new QAction( tr("Enter"), Resource::loadPixmap( "konsole/enter" ), QString::null, 0, this, 0 ); |
607 | connect( a, SIGNAL( activated() ), this, SLOT( hitEnter() ) ); a->addTo( toolBar ); | 607 | connect( a, SIGNAL( activated() ), this, SLOT( hitEnter() ) ); a->addTo( toolBar ); |
608 | a = new QAction( tr("Space"), Resource::loadPixmap( "konsole/space" ), QString::null, 0, this, 0 ); | 608 | a = new QAction( tr("Space"), Resource::loadPixmap( "konsole/space" ), QString::null, 0, this, 0 ); |
609 | connect( a, SIGNAL( activated() ), this, SLOT( hitSpace() ) ); a->addTo( toolBar ); | 609 | connect( a, SIGNAL( activated() ), this, SLOT( hitSpace() ) ); a->addTo( toolBar ); |
610 | a = new QAction( tr("Tab"), Resource::loadPixmap( "konsole/tab" ), QString::null, 0, this, 0 ); | 610 | a = new QAction( tr("Tab"), Resource::loadPixmap( "konsole/tab" ), QString::null, 0, this, 0 ); |
611 | connect( a, SIGNAL( activated() ), this, SLOT( hitTab() ) ); a->addTo( toolBar ); | 611 | connect( a, SIGNAL( activated() ), this, SLOT( hitTab() ) ); a->addTo( toolBar ); |
612 | a = new QAction( tr("Up"), Resource::loadPixmap( "konsole/up" ), QString::null, 0, this, 0 ); | 612 | a = new QAction( tr("Up"), Resource::loadPixmap( "konsole/up" ), QString::null, 0, this, 0 ); |
613 | connect( a, SIGNAL( activated() ), this, SLOT( hitUp() ) ); a->addTo( toolBar ); | 613 | connect( a, SIGNAL( activated() ), this, SLOT( hitUp() ) ); a->addTo( toolBar ); |
614 | a = new QAction( tr("Down"), Resource::loadPixmap( "konsole/down" ), QString::null, 0, this, 0 ); | 614 | a = new QAction( tr("Down"), Resource::loadPixmap( "konsole/down" ), QString::null, 0, this, 0 ); |
615 | connect( a, SIGNAL( activated() ), this, SLOT( hitDown() ) ); a->addTo( toolBar ); | 615 | connect( a, SIGNAL( activated() ), this, SLOT( hitDown() ) ); a->addTo( toolBar ); |
616 | 616 | ||
617 | a = new QAction( tr("Paste"), Resource::loadPixmap( "paste" ), QString::null, 0, this, 0 ); | 617 | a = new QAction( tr("Paste"), Resource::loadPixmap( "paste" ), QString::null, 0, this, 0 ); |
618 | connect( a, SIGNAL( activated() ), this, SLOT( hitPaste() ) ); | 618 | connect( a, SIGNAL( activated() ), this, SLOT( hitPaste() ) ); |
619 | a->addTo( toolBar ); | 619 | a->addTo( toolBar ); |
620 | 620 | ||
621 | secondToolBar = new QToolBar( this ); | 621 | secondToolBar = new QToolBar( this ); |
622 | secondToolBar->setHorizontalStretchable( TRUE ); | 622 | secondToolBar->setHorizontalStretchable( TRUE ); |
623 | 623 | ||
624 | commonCombo = new QComboBox( secondToolBar ); | 624 | commonCombo = new QComboBox( secondToolBar ); |
625 | // commonCombo->setMaximumWidth(236); | 625 | // commonCombo->setMaximumWidth(236); |
626 | 626 | ||
627 | ec_quick = editCommandListMenu->insertItem( tr( "Quick Edit" ) ); | 627 | ec_quick = editCommandListMenu->insertItem( tr( "Quick Edit" ) ); |
628 | if( listHidden) | 628 | if( listHidden) |
629 | { | 629 | { |
630 | secondToolBar->hide(); | 630 | secondToolBar->hide(); |
631 | editCommandListMenu->setItemEnabled(ec_quick ,FALSE); | 631 | editCommandListMenu->setItemEnabled(ec_quick ,FALSE); |
632 | } | 632 | } |
633 | ec_edit = editCommandListMenu->insertItem(tr( "Edit..." ) ); | 633 | ec_edit = editCommandListMenu->insertItem(tr( "Edit..." ) ); |
634 | 634 | ||
635 | cfg.setGroup("Commands"); | 635 | cfg.setGroup("Commands"); |
636 | commonCombo->setInsertionPolicy(QComboBox::AtCurrent); | 636 | commonCombo->setInsertionPolicy(QComboBox::AtCurrent); |
637 | 637 | ||
638 | initCommandList(); | 638 | initCommandList(); |
639 | // for (int i = 0; commonCmds[i] != NULL; i++) { | 639 | // for (int i = 0; commonCmds[i] != NULL; i++) { |
640 | // commonCombo->insertItem( commonCmds[i], i ); | 640 | // commonCombo->insertItem( commonCmds[i], i ); |
641 | // tmp = cfg.readEntry( QString::number(i),""); | 641 | // tmp = cfg.readEntry( QString::number(i),""); |
642 | // if(tmp != "") | 642 | // if(tmp != "") |
643 | // commonCombo->changeItem( tmp,i ); | 643 | // commonCombo->changeItem( tmp,i ); |
644 | // } | 644 | // } |
645 | 645 | ||
646 | connect( commonCombo, SIGNAL( activated(int) ), this, SLOT( enterCommand(int) )); | 646 | connect( commonCombo, SIGNAL( activated(int) ), this, SLOT( enterCommand(int) )); |
647 | 647 | ||
648 | sm_none = scrollMenu->insertItem(tr( "None" )); | 648 | sm_none = scrollMenu->insertItem(tr( "None" )); |
649 | sm_left = scrollMenu->insertItem(tr( "Left" )); | 649 | sm_left = scrollMenu->insertItem(tr( "Left" )); |
650 | sm_right = scrollMenu->insertItem(tr( "Right" )); | 650 | sm_right = scrollMenu->insertItem(tr( "Right" )); |
651 | // scrollMenu->insertSeparator(4); | 651 | // scrollMenu->insertSeparator(4); |
652 | // scrollMenu->insertItem(tr( "Horizontal" )); | 652 | // scrollMenu->insertItem(tr( "Horizontal" )); |
653 | 653 | ||
654 | configMenu->insertItem(tr( "ScrollBar" ),scrollMenu); | 654 | configMenu->insertItem(tr( "ScrollBar" ),scrollMenu); |
655 | 655 | ||
656 | configMenu->insertItem(tr( "History..." ), this, SLOT(historyDialog())); | 656 | configMenu->insertItem(tr( "History..." ), this, SLOT(historyDialog())); |
657 | 657 | ||
658 | cm_wrap = configMenu->insertItem(tr( "Wrap" )); | 658 | cm_wrap = configMenu->insertItem(tr( "Wrap" )); |
659 | cfg.setGroup("ScrollBar"); | 659 | cfg.setGroup("ScrollBar"); |
660 | configMenu->setItemChecked(cm_wrap, cfg.readBoolEntry("HorzScroll",0)); | 660 | configMenu->setItemChecked(cm_wrap, cfg.readBoolEntry("HorzScroll",0)); |
661 | 661 | ||
662 | cm_beep = configMenu->insertItem(tr( "Use Beep" )); | 662 | cm_beep = configMenu->insertItem(tr( "Use Beep" )); |
663 | cfg.setGroup("Menubar"); | 663 | cfg.setGroup("Menubar"); |
664 | configMenu->setItemChecked(cm_beep, cfg.readBoolEntry("useBeep",0)); | 664 | configMenu->setItemChecked(cm_beep, cfg.readBoolEntry("useBeep",0)); |
665 | 665 | ||
666 | fullscreen_msg = new QLabel(this); | 666 | fullscreen_msg = new QLabel(this); |
667 | fullscreen_msg-> setAlignment ( AlignCenter | SingleLine ); | 667 | fullscreen_msg-> setAlignment ( AlignCenter | SingleLine ); |
668 | fullscreen_msg-> hide(); | 668 | fullscreen_msg-> hide(); |
669 | fullscreen_msg-> setSizePolicy ( QSizePolicy ( QSizePolicy::Expanding, QSizePolicy::Expanding )); | 669 | fullscreen_msg-> setSizePolicy ( QSizePolicy ( QSizePolicy::Expanding, QSizePolicy::Expanding )); |
670 | fullscreen_msg-> setAutoResize(true); | 670 | fullscreen_msg-> setAutoResize(true); |
671 | fullscreen_msg-> setFrameStyle(QFrame::PopupPanel | QFrame::Raised); | 671 | fullscreen_msg-> setFrameStyle(QFrame::PopupPanel | QFrame::Raised); |
672 | fullscreen_msg-> setText(tr("To exit fullscreen, tap here.")); | 672 | fullscreen_msg-> setText(tr("To exit fullscreen, tap here.")); |
673 | 673 | ||
674 | fullscreen_timer = new QTimer(this); | 674 | fullscreen_timer = new QTimer(this); |
675 | connect(fullscreen_timer, SIGNAL(timeout()), | 675 | connect(fullscreen_timer, SIGNAL(timeout()), |
676 | this, SLOT(fullscreenTimeout())); | 676 | this, SLOT(fullscreenTimeout())); |
677 | show_fullscreen_msg = true; | 677 | show_fullscreen_msg = true; |
678 | 678 | ||
679 | //scrollMenuSelected(-29); | 679 | //scrollMenuSelected(-29); |
680 | // cfg.setGroup("ScrollBar"); | 680 | // cfg.setGroup("ScrollBar"); |
681 | // if(cfg.readBoolEntry("HorzScroll",0)) { | 681 | // if(cfg.readBoolEntry("HorzScroll",0)) { |
682 | // if(cfg.readNumEntry("Position",2) == 0) | 682 | // if(cfg.readNumEntry("Position",2) == 0) |
683 | // te->setScrollbarLocation(1); | 683 | // te->setScrollbarLocation(1); |
684 | // else | 684 | // else |
685 | // te->setScrollbarLocation(0); | 685 | // te->setScrollbarLocation(0); |
686 | // te->setScrollbarLocation( cfg.readNumEntry("Position",2)); | 686 | // te->setScrollbarLocation( cfg.readNumEntry("Position",2)); |
687 | // te->setWrapAt(120); | 687 | // te->setWrapAt(120); |
688 | // } | 688 | // } |
689 | // create applications ///////////////////////////////////////////////////// | 689 | // create applications ///////////////////////////////////////////////////// |
690 | setCentralWidget(tab); | 690 | setCentralWidget(tab); |
691 | 691 | ||
692 | // load keymaps //////////////////////////////////////////////////////////// | 692 | // load keymaps //////////////////////////////////////////////////////////// |
693 | KeyTrans::loadAll(); | 693 | KeyTrans::loadAll(); |
694 | for (int i = 0; i < KeyTrans::count(); i++) | 694 | for (int i = 0; i < KeyTrans::count(); i++) |
695 | { | 695 | { |
696 | KeyTrans* s = KeyTrans::find(i); | 696 | KeyTrans* s = KeyTrans::find(i); |
697 | assert( s ); | 697 | assert( s ); |
698 | } | 698 | } |
699 | 699 | ||
700 | se_pgm = _pgm; | 700 | se_pgm = _pgm; |
701 | se_args = _args; | 701 | se_args = _args; |
702 | 702 | ||
703 | cfg.setGroup("CommandLine"); | 703 | cfg.setGroup("CommandLine"); |
704 | 704 | ||
705 | if (cfg.hasKey("shell_args")) | 705 | if (cfg.hasKey("shell_args")) |
706 | { | 706 | { |
707 | QStringList se_args_list = cfg.readListEntry("shell_args",'|'); | 707 | QStringList se_args_list = cfg.readListEntry("shell_args",'|'); |
708 | for(uint i = 0; i < se_args_list.count(); i++) | 708 | for(uint i = 0; i < se_args_list.count(); i++) |
709 | { | 709 | { |
710 | se_args.prepend(se_args_list[se_args_list.count() - i - 1].latin1()); | 710 | se_args.prepend(se_args_list[se_args_list.count() - i - 1].latin1()); |
711 | } | 711 | } |
712 | } | 712 | } |
713 | else | 713 | else |
714 | { | 714 | { |
715 | se_args.prepend("--login"); | 715 | se_args.prepend("--login"); |
716 | } | 716 | } |
717 | 717 | ||
718 | se_pgm = cfg.readEntry("shell_bin", QString(se_pgm)); | 718 | se_pgm = cfg.readEntry("shell_bin", QString(se_pgm)); |
719 | 719 | ||
720 | // this is the "documentation" for those who know to look | 720 | // this is the "documentation" for those who know to look |
721 | if (! cfg.hasKey("shell_args")) | 721 | if (! cfg.hasKey("shell_args")) |
722 | { | 722 | { |
723 | cfg.writeEntry("shell_args",QStringList::fromStrList(se_args),'|'); | 723 | cfg.writeEntry("shell_args",QStringList::fromStrList(se_args),'|'); |
724 | } | 724 | } |
725 | if (! cfg.hasKey("shell_bin")) | 725 | if (! cfg.hasKey("shell_bin")) |
726 | { | 726 | { |
727 | cfg.writeEntry("shell_bin",QString(se_pgm)); | 727 | cfg.writeEntry("shell_bin",QString(se_pgm)); |
728 | } | 728 | } |
729 | 729 | ||
730 | parseCommandLine(); | 730 | parseCommandLine(); |
731 | 731 | ||
732 | // read and apply default values /////////////////////////////////////////// | 732 | // read and apply default values /////////////////////////////////////////// |
733 | resize(321, 321); // Dummy. | 733 | resize(321, 321); // Dummy. |
734 | QSize currentSize = size(); | 734 | QSize currentSize = size(); |
735 | if (currentSize != size()) | 735 | if (currentSize != size()) |
736 | defaultSize = size(); | 736 | defaultSize = size(); |
737 | 737 | ||
738 | 738 | ||
739 | /* allows us to catch cancel/escape */ | 739 | /* allows us to catch cancel/escape */ |
740 | reparent ( 0, WStyle_Customize | WStyle_NoBorder, | 740 | reparent ( 0, WStyle_Customize | WStyle_NoBorder, |
741 | QPoint ( 0, 0 )); | 741 | QPoint ( 0, 0 )); |
742 | } | 742 | } |
743 | 743 | ||
744 | void Konsole::show() | 744 | void Konsole::show() |
745 | { | 745 | { |
746 | if ( !nsessions ) | 746 | if ( !nsessions ) |
747 | { | 747 | { |
748 | newSession(); | 748 | newSession(); |
749 | } | 749 | } |
750 | QMainWindow::show(); | 750 | QMainWindow::show(); |
751 | 751 | ||
752 | } | 752 | } |
753 | 753 | ||
754 | void Konsole::initSession(const char*, QStrList &) | 754 | void Konsole::initSession(const char*, QStrList &) |
755 | { | 755 | { |
756 | QMainWindow::show(); | 756 | QMainWindow::show(); |
757 | } | 757 | } |
758 | 758 | ||
759 | Konsole::~Konsole() | 759 | Konsole::~Konsole() |
760 | { | 760 | { |
761 | while (nsessions > 0) | 761 | while (nsessions > 0) |
762 | { | 762 | { |
763 | doneSession(getTe(), 0); | 763 | doneSession(getTe(), 0); |
764 | } | 764 | } |
765 | } | 765 | } |
766 | 766 | ||
767 | void | 767 | void |
768 | Konsole::historyDialog() | 768 | Konsole::historyDialog() |
769 | { | 769 | { |
770 | QDialog *d = new QDialog ( this, "histdlg", true ); | 770 | QDialog *d = new QDialog ( this, "histdlg", true ); |
771 | // d-> setCaption ( tr( "History" )); | 771 | // d-> setCaption ( tr( "History" )); |
772 | 772 | ||
773 | QBoxLayout *lay = new QVBoxLayout ( d, 4, 4 ); | 773 | QBoxLayout *lay = new QVBoxLayout ( d, 4, 4 ); |
774 | 774 | ||
775 | QLabel *l = new QLabel ( tr( "History Lines:" ), d ); | 775 | QLabel *l = new QLabel ( tr( "History Lines:" ), d ); |
776 | lay-> addWidget ( l ); | 776 | lay-> addWidget ( l ); |
777 | 777 | ||
778 | Config cfg( "Konsole" ); | 778 | Config cfg( "Konsole" ); |
779 | cfg.setGroup("History"); | 779 | cfg.setGroup("History"); |
780 | int hist = cfg.readNumEntry("history_lines",300); | 780 | int hist = cfg.readNumEntry("history_lines",300); |
781 | int avg_line = cfg.readNumEntry("avg_line_length",60); | 781 | int avg_line = cfg.readNumEntry("avg_line_length",60); |
782 | 782 | ||
783 | QSpinBox *spin = new QSpinBox ( 1, 100000, 20, d ); | 783 | QSpinBox *spin = new QSpinBox ( 1, 100000, 20, d ); |
784 | spin-> setValue ( hist ); | 784 | spin-> setValue ( hist ); |
785 | spin-> setWrapping ( true ); | 785 | spin-> setWrapping ( true ); |
786 | spin-> setButtonSymbols ( QSpinBox::PlusMinus ); | 786 | spin-> setButtonSymbols ( QSpinBox::PlusMinus ); |
787 | lay-> addWidget ( spin ); | 787 | lay-> addWidget ( spin ); |
788 | 788 | ||
789 | if ( d-> exec ( ) == QDialog::Accepted ) | 789 | if ( d-> exec ( ) == QDialog::Accepted ) |
790 | { | 790 | { |
791 | cfg.writeEntry("history_lines", spin->value()); | 791 | cfg.writeEntry("history_lines", spin->value()); |
792 | cfg.writeEntry("avg_line_length", avg_line); | 792 | cfg.writeEntry("avg_line_length", avg_line); |
793 | if (getTe() != NULL) | 793 | if (getTe() != NULL) |
794 | { | 794 | { |
795 | getTe()->currentSession->setHistory(true); | 795 | getTe()->currentSession->setHistory(true); |
796 | } | 796 | } |
797 | } | 797 | } |
798 | 798 | ||
799 | delete d; | 799 | delete d; |
800 | } | 800 | } |
801 | 801 | ||
802 | 802 | ||
803 | void Konsole::cycleZoom() | 803 | void Konsole::cycleZoom() |
804 | { | 804 | { |
805 | TEWidget* te = getTe(); | 805 | TEWidget* te = getTe(); |
806 | QFont font = te->getVTFont(); | 806 | QFont font = te->getVTFont(); |
807 | int size = font.pointSize(); | 807 | int size = font.pointSize(); |
808 | changeFontSize(1); | 808 | changeFontSize(1); |
809 | font = te->getVTFont(); | 809 | font = te->getVTFont(); |
810 | if (font.pointSize() <= size) | 810 | if (font.pointSize() <= size) |
811 | { | 811 | { |
812 | do | 812 | do |
813 | { | 813 | { |
814 | font = te->getVTFont(); | 814 | font = te->getVTFont(); |
815 | size = font.pointSize(); | 815 | size = font.pointSize(); |
816 | changeFontSize(-1); | 816 | changeFontSize(-1); |
817 | font = te->getVTFont(); | 817 | font = te->getVTFont(); |
818 | } | 818 | } |
819 | while (font.pointSize() < size); | 819 | while (font.pointSize() < size); |
820 | } | 820 | } |
821 | } | 821 | } |
822 | 822 | ||
823 | void Konsole::changeFontSize(int delta) | 823 | void Konsole::changeFontSize(int delta) |
824 | { | 824 | { |
825 | // printf("delta font size %d\n", delta); | 825 | // printf("delta font size %d\n", delta); |
826 | TEWidget* te = getTe(); | 826 | TEWidget* te = getTe(); |
827 | QFont font = te->getVTFont(); | 827 | QFont font = te->getVTFont(); |
828 | int size = font.pointSize(); | 828 | int size = font.pointSize(); |
829 | int closest = delta > 0? 10000 : -10000; | 829 | int closest = delta > 0? 10000 : -10000; |
830 | int closest_font = -1; | 830 | int closest_font = -1; |
831 | for(uint i = 0; i < fonts.count(); i++) | 831 | for(uint i = 0; i < fonts.count(); i++) |
832 | { | 832 | { |
833 | if (fonts.at(i)->getFont() == font) | 833 | if (fonts.at(i)->getFont() == font) |
834 | { | 834 | { |
835 | if (delta > 0) | 835 | if (delta > 0) |
836 | { | 836 | { |
837 | if (i+1 < fonts.count() | 837 | if (i+1 < fonts.count() |
838 | && fonts.at(i+1)->getFamilyNum() == fonts.at(i)->getFamilyNum()) | 838 | && fonts.at(i+1)->getFamilyNum() == fonts.at(i)->getFamilyNum()) |
839 | { | 839 | { |
840 | setFont(i+1); | 840 | setFont(i+1); |
841 | printf("font %d\n", i+1); | 841 | printf("font %d\n", i+1); |
842 | return; | 842 | return; |
843 | } | 843 | } |
844 | } | 844 | } |
845 | else if (delta < 0) | 845 | else if (delta < 0) |
846 | { | 846 | { |
847 | if (i > 0 | 847 | if (i > 0 |
848 | && fonts.at(i-1)->getFamilyNum() == fonts.at(i)->getFamilyNum()) | 848 | && fonts.at(i-1)->getFamilyNum() == fonts.at(i)->getFamilyNum()) |
849 | { | 849 | { |
850 | setFont(i-1); | 850 | setFont(i-1); |
851 | printf("font %d\n", i-1); | 851 | printf("font %d\n", i-1); |
852 | return; | 852 | return; |
853 | } | 853 | } |
854 | } | 854 | } |
855 | } | 855 | } |
856 | int fsize = fonts.at(i)->getSize(); | 856 | int fsize = fonts.at(i)->getSize(); |
857 | printf("%d size=%d fsize=%d closest=%d\n", i, size, fsize, closest); | 857 | printf("%d size=%d fsize=%d closest=%d\n", i, size, fsize, closest); |
858 | if ((delta > 0 && fsize > size && fsize < closest) | 858 | if ((delta > 0 && fsize > size && fsize < closest) |
859 | || (delta < 0 && fsize < size && fsize > closest)) | 859 | || (delta < 0 && fsize < size && fsize > closest)) |
860 | { | 860 | { |
861 | closest = fsize; | 861 | closest = fsize; |
862 | closest_font = i; | 862 | closest_font = i; |
863 | } | 863 | } |
864 | } | 864 | } |
865 | if (closest_font >= 0) | 865 | if (closest_font >= 0) |
866 | { | 866 | { |
867 | printf("font closest %d (%d)\n", closest_font, closest); | 867 | printf("font closest %d (%d)\n", closest_font, closest); |
868 | setFont(closest_font); | 868 | setFont(closest_font); |
869 | } | 869 | } |
870 | } | 870 | } |
871 | 871 | ||
872 | int Konsole::findFont(const QString& name, int size, bool exactMatch) | 872 | int Konsole::findFont(const QString& name, int size, bool exactMatch) |
873 | { | 873 | { |
874 | for(uint i = 0; i < fonts.count(); i++) | 874 | for(uint i = 0; i < fonts.count(); i++) |
875 | { | 875 | { |
876 | if (fonts.at(i)->getName() == name | 876 | if (fonts.at(i)->getName() == name |
877 | && fonts.at(i)->getSize() == size) | 877 | && fonts.at(i)->getSize() == size) |
878 | { | 878 | { |
879 | return(i); | 879 | return(i); |
880 | } | 880 | } |
881 | } | 881 | } |
882 | if (exactMatch) | 882 | if (exactMatch) |
883 | { | 883 | { |
884 | return(-1); | 884 | return(-1); |
885 | } | 885 | } |
886 | for(uint i = 0; i < fonts.count(); i++) | 886 | for(uint i = 0; i < fonts.count(); i++) |
887 | { | 887 | { |
888 | if (fonts.at(i)->getSize() == size) | 888 | if (fonts.at(i)->getSize() == size) |
889 | { | 889 | { |
890 | return(i); | 890 | return(i); |
891 | } | 891 | } |
892 | } | 892 | } |
893 | return(-1); | 893 | return(-1); |
894 | } | 894 | } |
895 | 895 | ||
896 | void Konsole::setFont(int f) | 896 | void Konsole::setFont(int f) |
897 | { | 897 | { |
898 | VTFont* font = fonts.at(f); | 898 | VTFont* font = fonts.at(f); |
899 | if (font) | 899 | if (font) |
900 | { | 900 | { |
901 | TEWidget* te = getTe(); | 901 | TEWidget* te = getTe(); |
902 | if (te != 0) | 902 | if (te != 0) |
903 | { | 903 | { |
904 | te->setVTFont(font->getFont()); | 904 | te->setVTFont(font->getFont()); |
905 | } | 905 | } |
906 | cfont = f; | 906 | cfont = f; |
907 | 907 | ||
908 | int familyNum = font->getFamilyNum(); | 908 | int familyNum = font->getFamilyNum(); |
909 | int size = font->getSize(); | 909 | int size = font->getSize(); |
910 | printf("familyNum = %d size = %d count=%d\n", familyNum, size, | 910 | printf("familyNum = %d size = %d count=%d\n", familyNum, size, |
911 | fontList->count()); | 911 | fontList->count()); |
912 | for(int i = 0; i < (int)fontList->count(); i++) | 912 | for(int i = 0; i < (int)fontList->count(); i++) |
913 | { | 913 | { |
914 | fontList->setItemChecked(i + 1000, i == familyNum); | 914 | fontList->setItemChecked(i + 1000, i == familyNum); |
915 | } | 915 | } |
916 | for(int i = 0; i < (int)fonts.count(); i++) | 916 | for(int i = 0; i < (int)fonts.count(); i++) |
917 | { | 917 | { |
918 | fontList->setItemChecked(i, fonts.at(i)->getFamilyNum() == familyNum | 918 | fontList->setItemChecked(i, fonts.at(i)->getFamilyNum() == familyNum |
919 | && fonts.at(i)->getSize() == size); | 919 | && fonts.at(i)->getSize() == size); |
920 | } | 920 | } |
921 | Config cfg( "Konsole" ); | 921 | Config cfg( "Konsole" ); |
922 | cfg.setGroup("Font"); | 922 | cfg.setGroup("Font"); |
923 | QString ss = "Session"+ QString::number(tab->currentPageIndex()+1); | 923 | QString ss = "Session"+ QString::number(tab->currentPageIndex()+1); |
924 | if (tab->currentPageIndex() == 0) | 924 | if (tab->currentPageIndex() == 0) |
925 | { | 925 | { |
926 | cfg.writeEntry("FontName", fonts.at(cfont)->getFamily()); | 926 | cfg.writeEntry("FontName", fonts.at(cfont)->getFamily()); |
927 | cfg.writeEntry("FontSize", fonts.at(cfont)->getSize()); | 927 | cfg.writeEntry("FontSize", fonts.at(cfont)->getSize()); |
928 | } | 928 | } |
929 | cfg.writeEntry("FontName"+ss, fonts.at(cfont)->getFamily()); | 929 | cfg.writeEntry("FontName"+ss, fonts.at(cfont)->getFamily()); |
930 | cfg.writeEntry("FontSize"+ss, fonts.at(cfont)->getSize()); | 930 | cfg.writeEntry("FontSize"+ss, fonts.at(cfont)->getSize()); |
931 | } | 931 | } |
932 | } | 932 | } |
933 | 933 | ||
934 | #if 0 | 934 | #if 0 |
935 | void Konsole::fontChanged(int f) | 935 | void Konsole::fontChanged(int f) |
936 | { | 936 | { |
937 | VTFont* font = fonts.at(f); | 937 | VTFont* font = fonts.at(f); |
938 | if (font != 0) | 938 | if (font != 0) |
939 | { | 939 | { |