author | kergoth <kergoth> | 2002-02-01 16:50:44 (UTC) |
---|---|---|
committer | kergoth <kergoth> | 2002-02-01 16:50:44 (UTC) |
commit | 4ffeffe4e91867dca42c02ddc5521d4182cabbb6 (patch) (unidiff) | |
tree | af230edd81ebf47d090478d3048f459b1e685582 | |
parent | 07ec85f797cad04431df30855a81b88f06fe27d3 (diff) | |
download | opie-4ffeffe4e91867dca42c02ddc5521d4182cabbb6.zip opie-4ffeffe4e91867dca42c02ddc5521d4182cabbb6.tar.gz opie-4ffeffe4e91867dca42c02ddc5521d4182cabbb6.tar.bz2 |
Per ljp, uncommented line 680.
-rw-r--r-- | core/apps/embeddedkonsole/konsole.cpp | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/core/apps/embeddedkonsole/konsole.cpp b/core/apps/embeddedkonsole/konsole.cpp index 1102ef3..f3f0c29 100644 --- a/core/apps/embeddedkonsole/konsole.cpp +++ b/core/apps/embeddedkonsole/konsole.cpp | |||
@@ -1,762 +1,762 @@ | |||
1 | /* ---------------------------------------------------------------------- */ | 1 | /* ---------------------------------------------------------------------- */ |
2 | /* */ | 2 | /* */ |
3 | /* [main.C] Konsole */ | 3 | /* [main.C] Konsole */ |
4 | /* */ | 4 | /* */ |
5 | /* ---------------------------------------------------------------------- */ | 5 | /* ---------------------------------------------------------------------- */ |
6 | /* */ | 6 | /* */ |
7 | /* Copyright (c) 1997,1998 by Lars Doelle <lars.doelle@on-line.de> */ | 7 | /* Copyright (c) 1997,1998 by Lars Doelle <lars.doelle@on-line.de> */ |
8 | /* */ | 8 | /* */ |
9 | /* This file is part of Konsole, an X terminal. */ | 9 | /* This file is part of Konsole, an X terminal. */ |
10 | /* */ | 10 | /* */ |
11 | /* The material contained in here more or less directly orginates from */ | 11 | /* The material contained in here more or less directly orginates from */ |
12 | /* kvt, which is copyright (c) 1996 by Matthias Ettrich <ettrich@kde.org> */ | 12 | /* kvt, which is copyright (c) 1996 by Matthias Ettrich <ettrich@kde.org> */ |
13 | /* */ | 13 | /* */ |
14 | /* ---------------------------------------------------------------------- */ | 14 | /* ---------------------------------------------------------------------- */ |
15 | /* */ | 15 | /* */ |
16 | /* Ported Konsole to Qt/Embedded */ | 16 | /* Ported Konsole to Qt/Embedded */ |
17 | /* */ | 17 | /* */ |
18 | /* Copyright (C) 2000 by John Ryland <jryland@trolltech.com> */ | 18 | /* Copyright (C) 2000 by John Ryland <jryland@trolltech.com> */ |
19 | /* */ | 19 | /* */ |
20 | /* -------------------------------------------------------------------------- */ | 20 | /* -------------------------------------------------------------------------- */ |
21 | 21 | ||
22 | #include <qpe/resource.h> | 22 | #include <qpe/resource.h> |
23 | 23 | ||
24 | #include <qdir.h> | 24 | #include <qdir.h> |
25 | #include <qevent.h> | 25 | #include <qevent.h> |
26 | #include <qdragobject.h> | 26 | #include <qdragobject.h> |
27 | #include <qobjectlist.h> | 27 | #include <qobjectlist.h> |
28 | #include <qtoolbutton.h> | 28 | #include <qtoolbutton.h> |
29 | #include <qpe/qpetoolbar.h> | 29 | #include <qpe/qpetoolbar.h> |
30 | #include <qpushbutton.h> | 30 | #include <qpushbutton.h> |
31 | #include <qfontdialog.h> | 31 | #include <qfontdialog.h> |
32 | #include <qglobal.h> | 32 | #include <qglobal.h> |
33 | #include <qpainter.h> | 33 | #include <qpainter.h> |
34 | #include <qpe/qpemenubar.h> | 34 | #include <qpe/qpemenubar.h> |
35 | #include <qmessagebox.h> | 35 | #include <qmessagebox.h> |
36 | #include <qaction.h> | 36 | #include <qaction.h> |
37 | #include <qapplication.h> | 37 | #include <qapplication.h> |
38 | #include <qfontmetrics.h> | 38 | #include <qfontmetrics.h> |
39 | #include <qcombobox.h> | 39 | #include <qcombobox.h> |
40 | #include <qevent.h> | 40 | #include <qevent.h> |
41 | #include <qtabwidget.h> | 41 | #include <qtabwidget.h> |
42 | #include <qtabbar.h> | 42 | #include <qtabbar.h> |
43 | #include <qpe/config.h> | 43 | #include <qpe/config.h> |
44 | #include <qstringlist.h> | 44 | #include <qstringlist.h> |
45 | #include <qpalette.h> | 45 | #include <qpalette.h> |
46 | 46 | ||
47 | #include <sys/wait.h> | 47 | #include <sys/wait.h> |
48 | #include <stdio.h> | 48 | #include <stdio.h> |
49 | #include <stdlib.h> | 49 | #include <stdlib.h> |
50 | #include <assert.h> | 50 | #include <assert.h> |
51 | 51 | ||
52 | #include "konsole.h" | 52 | #include "konsole.h" |
53 | #include "keytrans.h" | 53 | #include "keytrans.h" |
54 | 54 | ||
55 | class EKNumTabBar : public QTabBar { | 55 | class EKNumTabBar : public QTabBar { |
56 | public: | 56 | public: |
57 | void numberTabs() | 57 | void numberTabs() |
58 | { | 58 | { |
59 | // Yes, it really is this messy. QTabWidget needs functions | 59 | // Yes, it really is this messy. QTabWidget needs functions |
60 | // that provide acces to tabs in a sequential way. | 60 | // that provide acces to tabs in a sequential way. |
61 | int m=INT_MIN; | 61 | int m=INT_MIN; |
62 | for (int i=0; i<count(); i++) { | 62 | for (int i=0; i<count(); i++) { |
63 | QTab* left=0; | 63 | QTab* left=0; |
64 | QListIterator<QTab> it(*tabList()); | 64 | QListIterator<QTab> it(*tabList()); |
65 | int x=INT_MAX; | 65 | int x=INT_MAX; |
66 | for( QTab* t; (t=it.current()); ++it ) { | 66 | for( QTab* t; (t=it.current()); ++it ) { |
67 | int tx = t->rect().x(); | 67 | int tx = t->rect().x(); |
68 | if ( tx<x && tx>m ) { | 68 | if ( tx<x && tx>m ) { |
69 | x = tx; | 69 | x = tx; |
70 | left = t; | 70 | left = t; |
71 | } | 71 | } |
72 | } | 72 | } |
73 | if ( left ) { | 73 | if ( left ) { |
74 | left->setText(QString::number(i+1)); | 74 | left->setText(QString::number(i+1)); |
75 | m = left->rect().x(); | 75 | m = left->rect().x(); |
76 | } | 76 | } |
77 | } | 77 | } |
78 | } | 78 | } |
79 | }; | 79 | }; |
80 | 80 | ||
81 | class EKNumTabWidget : public QTabWidget { | 81 | class EKNumTabWidget : public QTabWidget { |
82 | public: | 82 | public: |
83 | EKNumTabWidget(QWidget* parent) : QTabWidget(parent) | 83 | EKNumTabWidget(QWidget* parent) : QTabWidget(parent) |
84 | { | 84 | { |
85 | } | 85 | } |
86 | 86 | ||
87 | void addTab(QWidget* w) | 87 | void addTab(QWidget* w) |
88 | { | 88 | { |
89 | QTab* t = new QTab(QString::number(tabBar()->count()+1)); | 89 | QTab* t = new QTab(QString::number(tabBar()->count()+1)); |
90 | QTabWidget::addTab(w,t); | 90 | QTabWidget::addTab(w,t); |
91 | } | 91 | } |
92 | 92 | ||
93 | void removeTab(QWidget* w) | 93 | void removeTab(QWidget* w) |
94 | { | 94 | { |
95 | removePage(w); | 95 | removePage(w); |
96 | ((EKNumTabBar*)tabBar())->numberTabs(); | 96 | ((EKNumTabBar*)tabBar())->numberTabs(); |
97 | } | 97 | } |
98 | }; | 98 | }; |
99 | 99 | ||
100 | // This could be configurable or dynamicly generated from the bash history | 100 | // This could be configurable or dynamicly generated from the bash history |
101 | // file of the user | 101 | // file of the user |
102 | static const char *commonCmds[] = | 102 | static const char *commonCmds[] = |
103 | { | 103 | { |
104 | "ls ", // I left this here, cause it looks better than the first alpha | 104 | "ls ", // I left this here, cause it looks better than the first alpha |
105 | "cardctl eject", | 105 | "cardctl eject", |
106 | "cat ", | 106 | "cat ", |
107 | "cd ", | 107 | "cd ", |
108 | "chmod ", | 108 | "chmod ", |
109 | "cp ", | 109 | "cp ", |
110 | "dc ", | 110 | "dc ", |
111 | "df ", | 111 | "df ", |
112 | "dmesg", | 112 | "dmesg", |
113 | "echo ", | 113 | "echo ", |
114 | "find ", | 114 | "find ", |
115 | "free", | 115 | "free", |
116 | "grep ", | 116 | "grep ", |
117 | "ifconfig ", | 117 | "ifconfig ", |
118 | "ipkg ", | 118 | "ipkg ", |
119 | "mkdir ", | 119 | "mkdir ", |
120 | "mv ", | 120 | "mv ", |
121 | "nc localhost 7776", | 121 | "nc localhost 7776", |
122 | "nc localhost 7777", | 122 | "nc localhost 7777", |
123 | "nslookup ", | 123 | "nslookup ", |
124 | "ping ", | 124 | "ping ", |
125 | "ps aux", | 125 | "ps aux", |
126 | "pwd ", | 126 | "pwd ", |
127 | "rm ", | 127 | "rm ", |
128 | "rmdir ", | 128 | "rmdir ", |
129 | "route ", | 129 | "route ", |
130 | "set ", | 130 | "set ", |
131 | "traceroute", | 131 | "traceroute", |
132 | 132 | ||
133 | /* | 133 | /* |
134 | "gzip", | 134 | "gzip", |
135 | "gunzip", | 135 | "gunzip", |
136 | "chgrp", | 136 | "chgrp", |
137 | "chown", | 137 | "chown", |
138 | "date", | 138 | "date", |
139 | "dd", | 139 | "dd", |
140 | "df", | 140 | "df", |
141 | "dmesg", | 141 | "dmesg", |
142 | "fuser", | 142 | "fuser", |
143 | "hostname", | 143 | "hostname", |
144 | "kill", | 144 | "kill", |
145 | "killall", | 145 | "killall", |
146 | "ln", | 146 | "ln", |
147 | "ping", | 147 | "ping", |
148 | "mount", | 148 | "mount", |
149 | "more", | 149 | "more", |
150 | "sort", | 150 | "sort", |
151 | "touch", | 151 | "touch", |
152 | "umount", | 152 | "umount", |
153 | "mknod", | 153 | "mknod", |
154 | "netstat", | 154 | "netstat", |
155 | */ | 155 | */ |
156 | 156 | ||
157 | "exit", | 157 | "exit", |
158 | NULL | 158 | NULL |
159 | }; | 159 | }; |
160 | 160 | ||
161 | 161 | ||
162 | Konsole::Konsole(QWidget* parent, const char* name, WFlags fl) : | 162 | Konsole::Konsole(QWidget* parent, const char* name, WFlags fl) : |
163 | QMainWindow(parent, name, fl) | 163 | QMainWindow(parent, name, fl) |
164 | { | 164 | { |
165 | QStrList args; | 165 | QStrList args; |
166 | init("/bin/sh",args); | 166 | init("/bin/sh",args); |
167 | } | 167 | } |
168 | 168 | ||
169 | Konsole::Konsole(const char* name, const char* _pgm, QStrList & _args, int) | 169 | Konsole::Konsole(const char* name, const char* _pgm, QStrList & _args, int) |
170 | : QMainWindow(0, name) | 170 | : QMainWindow(0, name) |
171 | { | 171 | { |
172 | init(_pgm,_args); | 172 | init(_pgm,_args); |
173 | } | 173 | } |
174 | 174 | ||
175 | void Konsole::init(const char* _pgm, QStrList & _args) | 175 | void Konsole::init(const char* _pgm, QStrList & _args) |
176 | { | 176 | { |
177 | b_scroll = TRUE; // histon; | 177 | b_scroll = TRUE; // histon; |
178 | n_keytab = 0; | 178 | n_keytab = 0; |
179 | n_render = 0; | 179 | n_render = 0; |
180 | 180 | ||
181 | setCaption( tr("Terminal") ); | 181 | setCaption( tr("Terminal") ); |
182 | setIcon( Resource::loadPixmap( "konsole" ) ); | 182 | setIcon( Resource::loadPixmap( "konsole" ) ); |
183 | 183 | ||
184 | Config cfg("Konsole"); | 184 | Config cfg("Konsole"); |
185 | cfg.setGroup("Konsole"); | 185 | cfg.setGroup("Konsole"); |
186 | QString tmp; | 186 | QString tmp; |
187 | // initialize the list of allowed fonts /////////////////////////////////// | 187 | // initialize the list of allowed fonts /////////////////////////////////// |
188 | cfont = cfg.readNumEntry("FontID", 1); | 188 | cfont = cfg.readNumEntry("FontID", 1); |
189 | QFont f = QFont("Micro", 4, QFont::Normal); | 189 | QFont f = QFont("Micro", 4, QFont::Normal); |
190 | f.setFixedPitch(TRUE); | 190 | f.setFixedPitch(TRUE); |
191 | fonts.append(new VTFont(tr("Micro"), f)); | 191 | fonts.append(new VTFont(tr("Micro"), f)); |
192 | 192 | ||
193 | f = QFont("Fixed", 7, QFont::Normal); | 193 | f = QFont("Fixed", 7, QFont::Normal); |
194 | f.setFixedPitch(TRUE); | 194 | f.setFixedPitch(TRUE); |
195 | fonts.append(new VTFont(tr("Small Fixed"), f)); | 195 | fonts.append(new VTFont(tr("Small Fixed"), f)); |
196 | 196 | ||
197 | f = QFont("Fixed", 12, QFont::Normal); | 197 | f = QFont("Fixed", 12, QFont::Normal); |
198 | f.setFixedPitch(TRUE); | 198 | f.setFixedPitch(TRUE); |
199 | fonts.append(new VTFont(tr("Medium Fixed"), f)); | 199 | fonts.append(new VTFont(tr("Medium Fixed"), f)); |
200 | 200 | ||
201 | // create terminal emulation framework //////////////////////////////////// | 201 | // create terminal emulation framework //////////////////////////////////// |
202 | nsessions = 0; | 202 | nsessions = 0; |
203 | 203 | ||
204 | tab = new EKNumTabWidget(this); | 204 | tab = new EKNumTabWidget(this); |
205 | 205 | ||
206 | connect(tab, SIGNAL(currentChanged(QWidget*)), this, SLOT(switchSession(QWidget*))); | 206 | connect(tab, SIGNAL(currentChanged(QWidget*)), this, SLOT(switchSession(QWidget*))); |
207 | 207 | ||
208 | // create terminal toolbar //////////////////////////////////////////////// | 208 | // create terminal toolbar //////////////////////////////////////////////// |
209 | setToolBarsMovable( FALSE ); | 209 | setToolBarsMovable( FALSE ); |
210 | QPEToolBar *menuToolBar = new QPEToolBar( this ); | 210 | QPEToolBar *menuToolBar = new QPEToolBar( this ); |
211 | menuToolBar->setHorizontalStretchable( TRUE ); | 211 | menuToolBar->setHorizontalStretchable( TRUE ); |
212 | 212 | ||
213 | QPEMenuBar *menuBar = new QPEMenuBar( menuToolBar ); | 213 | QPEMenuBar *menuBar = new QPEMenuBar( menuToolBar ); |
214 | 214 | ||
215 | fontList = new QPopupMenu( this ); | 215 | fontList = new QPopupMenu( this ); |
216 | for(uint i = 0; i < fonts.count(); i++) { | 216 | for(uint i = 0; i < fonts.count(); i++) { |
217 | VTFont *fnt = fonts.at(i); | 217 | VTFont *fnt = fonts.at(i); |
218 | fontList->insertItem(fnt->getName(), i); | 218 | fontList->insertItem(fnt->getName(), i); |
219 | } | 219 | } |
220 | fontChanged(cfont); | 220 | fontChanged(cfont); |
221 | 221 | ||
222 | configMenu = new QPopupMenu( this); | 222 | configMenu = new QPopupMenu( this); |
223 | colorMenu = new QPopupMenu( this); | 223 | colorMenu = new QPopupMenu( this); |
224 | 224 | ||
225 | bool listHidden; | 225 | bool listHidden; |
226 | cfg.setGroup("Menubar"); | 226 | cfg.setGroup("Menubar"); |
227 | if( cfg.readEntry("Hidden","FALSE") == "TRUE") { | 227 | if( cfg.readEntry("Hidden","FALSE") == "TRUE") { |
228 | configMenu->insertItem("Show command list"); | 228 | configMenu->insertItem("Show command list"); |
229 | listHidden=TRUE; | 229 | listHidden=TRUE; |
230 | } else { | 230 | } else { |
231 | configMenu->insertItem("Hide command list"); | 231 | configMenu->insertItem("Hide command list"); |
232 | listHidden=FALSE; | 232 | listHidden=FALSE; |
233 | } | 233 | } |
234 | 234 | ||
235 | cfg.setGroup("Tabs"); | 235 | cfg.setGroup("Tabs"); |
236 | tmp=cfg.readEntry("Position","Bottom"); | 236 | tmp=cfg.readEntry("Position","Bottom"); |
237 | if(tmp=="Top") { | 237 | if(tmp=="Top") { |
238 | tab->setTabPosition(QTabWidget::Top); | 238 | tab->setTabPosition(QTabWidget::Top); |
239 | configMenu->insertItem("Tabs on Bottom"); | 239 | configMenu->insertItem("Tabs on Bottom"); |
240 | } else { | 240 | } else { |
241 | tab->setTabPosition(QTabWidget::Bottom); | 241 | tab->setTabPosition(QTabWidget::Bottom); |
242 | configMenu->insertItem("Tabs on Top"); | 242 | configMenu->insertItem("Tabs on Top"); |
243 | } | 243 | } |
244 | configMenu->insertSeparator(2); | 244 | configMenu->insertSeparator(2); |
245 | 245 | ||
246 | colorMenu->insertItem("Green on Black"); | 246 | colorMenu->insertItem("Green on Black"); |
247 | colorMenu->insertItem("Black on White"); | 247 | colorMenu->insertItem("Black on White"); |
248 | colorMenu->insertItem("White on Black"); | 248 | colorMenu->insertItem("White on Black"); |
249 | colorMenu->insertItem("Black on Transparent"); | 249 | colorMenu->insertItem("Black on Transparent"); |
250 | colorMenu->insertItem("Black on Red"); | 250 | colorMenu->insertItem("Black on Red"); |
251 | colorMenu->insertItem("Red on Black"); | 251 | colorMenu->insertItem("Red on Black"); |
252 | colorMenu->insertItem("Green on Yellow"); | 252 | colorMenu->insertItem("Green on Yellow"); |
253 | colorMenu->insertItem("Blue on Magenta"); | 253 | colorMenu->insertItem("Blue on Magenta"); |
254 | colorMenu->insertItem("Magenta on Blue"); | 254 | colorMenu->insertItem("Magenta on Blue"); |
255 | colorMenu->insertItem("Cyan on White"); | 255 | colorMenu->insertItem("Cyan on White"); |
256 | colorMenu->insertItem("White on Cyan"); | 256 | colorMenu->insertItem("White on Cyan"); |
257 | colorMenu->insertItem("Blue on Black"); | 257 | colorMenu->insertItem("Blue on Black"); |
258 | configMenu->insertItem("Colors",colorMenu); | 258 | configMenu->insertItem("Colors",colorMenu); |
259 | 259 | ||
260 | connect( fontList, SIGNAL( activated(int) ), this, SLOT( fontChanged(int) )); | 260 | connect( fontList, SIGNAL( activated(int) ), this, SLOT( fontChanged(int) )); |
261 | connect( configMenu, SIGNAL( activated(int) ), this, SLOT( configMenuSelected(int) )); | 261 | connect( configMenu, SIGNAL( activated(int) ), this, SLOT( configMenuSelected(int) )); |
262 | connect( colorMenu, SIGNAL( activated(int) ), this, SLOT( colorMenuSelected(int) )); | 262 | connect( colorMenu, SIGNAL( activated(int) ), this, SLOT( colorMenuSelected(int) )); |
263 | 263 | ||
264 | menuBar->insertItem( tr("Font"), fontList ); | 264 | menuBar->insertItem( tr("Font"), fontList ); |
265 | menuBar->insertItem( tr("Options"), configMenu ); | 265 | menuBar->insertItem( tr("Options"), configMenu ); |
266 | 266 | ||
267 | QPEToolBar *toolbar = new QPEToolBar( this ); | 267 | QPEToolBar *toolbar = new QPEToolBar( this ); |
268 | 268 | ||
269 | QAction *a; | 269 | QAction *a; |
270 | 270 | ||
271 | // Button Commands | 271 | // Button Commands |
272 | a = new QAction( tr("New"), Resource::loadPixmap( "konsole" ), QString::null, 0, this, 0 ); | 272 | a = new QAction( tr("New"), Resource::loadPixmap( "konsole" ), QString::null, 0, this, 0 ); |
273 | connect( a, SIGNAL( activated() ), this, SLOT( newSession() ) ); a->addTo( toolbar ); | 273 | connect( a, SIGNAL( activated() ), this, SLOT( newSession() ) ); a->addTo( toolbar ); |
274 | a = new QAction( tr("Enter"), Resource::loadPixmap( "konsole/enter" ), QString::null, 0, this, 0 ); | 274 | a = new QAction( tr("Enter"), Resource::loadPixmap( "konsole/enter" ), QString::null, 0, this, 0 ); |
275 | connect( a, SIGNAL( activated() ), this, SLOT( hitEnter() ) ); a->addTo( toolbar ); | 275 | connect( a, SIGNAL( activated() ), this, SLOT( hitEnter() ) ); a->addTo( toolbar ); |
276 | a = new QAction( tr("Space"), Resource::loadPixmap( "konsole/space" ), QString::null, 0, this, 0 ); | 276 | a = new QAction( tr("Space"), Resource::loadPixmap( "konsole/space" ), QString::null, 0, this, 0 ); |
277 | connect( a, SIGNAL( activated() ), this, SLOT( hitSpace() ) ); a->addTo( toolbar ); | 277 | connect( a, SIGNAL( activated() ), this, SLOT( hitSpace() ) ); a->addTo( toolbar ); |
278 | a = new QAction( tr("Tab"), Resource::loadPixmap( "konsole/tab" ), QString::null, 0, this, 0 ); | 278 | a = new QAction( tr("Tab"), Resource::loadPixmap( "konsole/tab" ), QString::null, 0, this, 0 ); |
279 | connect( a, SIGNAL( activated() ), this, SLOT( hitTab() ) ); a->addTo( toolbar ); | 279 | connect( a, SIGNAL( activated() ), this, SLOT( hitTab() ) ); a->addTo( toolbar ); |
280 | a = new QAction( tr("Up"), Resource::loadPixmap( "konsole/up" ), QString::null, 0, this, 0 ); | 280 | a = new QAction( tr("Up"), Resource::loadPixmap( "konsole/up" ), QString::null, 0, this, 0 ); |
281 | connect( a, SIGNAL( activated() ), this, SLOT( hitUp() ) ); a->addTo( toolbar ); | 281 | connect( a, SIGNAL( activated() ), this, SLOT( hitUp() ) ); a->addTo( toolbar ); |
282 | a = new QAction( tr("Down"), Resource::loadPixmap( "konsole/down" ), QString::null, 0, this, 0 ); | 282 | a = new QAction( tr("Down"), Resource::loadPixmap( "konsole/down" ), QString::null, 0, this, 0 ); |
283 | connect( a, SIGNAL( activated() ), this, SLOT( hitDown() ) ); a->addTo( toolbar ); | 283 | connect( a, SIGNAL( activated() ), this, SLOT( hitDown() ) ); a->addTo( toolbar ); |
284 | a = new QAction( tr("Paste"), Resource::loadPixmap( "paste" ), QString::null, 0, this, 0 ); | 284 | a = new QAction( tr("Paste"), Resource::loadPixmap( "paste" ), QString::null, 0, this, 0 ); |
285 | connect( a, SIGNAL( activated() ), this, SLOT( hitPaste() ) ); a->addTo( toolbar ); | 285 | connect( a, SIGNAL( activated() ), this, SLOT( hitPaste() ) ); a->addTo( toolbar ); |
286 | /* | 286 | /* |
287 | a = new QAction( tr("Up"), Resource::loadPixmap( "up" ), QString::null, 0, this, 0 ); | 287 | a = new QAction( tr("Up"), Resource::loadPixmap( "up" ), QString::null, 0, this, 0 ); |
288 | connect( a, SIGNAL( activated() ), this, SLOT( hitUp() ) ); a->addTo( toolbar ); | 288 | connect( a, SIGNAL( activated() ), this, SLOT( hitUp() ) ); a->addTo( toolbar ); |
289 | a = new QAction( tr("Down"), Resource::loadPixmap( "down" ), QString::null, 0, this, 0 ); | 289 | a = new QAction( tr("Down"), Resource::loadPixmap( "down" ), QString::null, 0, this, 0 ); |
290 | connect( a, SIGNAL( activated() ), this, SLOT( hitDown() ) ); a->addTo( toolbar ); | 290 | connect( a, SIGNAL( activated() ), this, SLOT( hitDown() ) ); a->addTo( toolbar ); |
291 | */ | 291 | */ |
292 | 292 | ||
293 | secondToolBar = new QPEToolBar( this ); | 293 | secondToolBar = new QPEToolBar( this ); |
294 | secondToolBar->setHorizontalStretchable( TRUE ); | 294 | secondToolBar->setHorizontalStretchable( TRUE ); |
295 | 295 | ||
296 | commonCombo = new QComboBox( secondToolBar ); | 296 | commonCombo = new QComboBox( secondToolBar ); |
297 | 297 | ||
298 | if( listHidden) | 298 | if( listHidden) |
299 | secondToolBar->hide(); | 299 | secondToolBar->hide(); |
300 | configMenu->insertItem( "Edit Command List"); | 300 | configMenu->insertItem( "Edit Command List"); |
301 | 301 | ||
302 | cfg.setGroup("Commands"); | 302 | cfg.setGroup("Commands"); |
303 | commonCombo->setInsertionPolicy(QComboBox::AtCurrent); | 303 | commonCombo->setInsertionPolicy(QComboBox::AtCurrent); |
304 | 304 | ||
305 | for (int i = 0; commonCmds[i] != NULL; i++) { | 305 | for (int i = 0; commonCmds[i] != NULL; i++) { |
306 | commonCombo->insertItem( commonCmds[i], i ); | 306 | commonCombo->insertItem( commonCmds[i], i ); |
307 | tmp = cfg.readEntry( QString::number(i),""); | 307 | tmp = cfg.readEntry( QString::number(i),""); |
308 | if(tmp != "") | 308 | if(tmp != "") |
309 | commonCombo->changeItem( tmp,i ); | 309 | commonCombo->changeItem( tmp,i ); |
310 | } | 310 | } |
311 | 311 | ||
312 | connect( commonCombo, SIGNAL( activated(int) ), this, SLOT( enterCommand(int) )); | 312 | connect( commonCombo, SIGNAL( activated(int) ), this, SLOT( enterCommand(int) )); |
313 | 313 | ||
314 | // create applications ///////////////////////////////////////////////////// | 314 | // create applications ///////////////////////////////////////////////////// |
315 | setCentralWidget(tab); | 315 | setCentralWidget(tab); |
316 | 316 | ||
317 | // load keymaps //////////////////////////////////////////////////////////// | 317 | // load keymaps //////////////////////////////////////////////////////////// |
318 | KeyTrans::loadAll(); | 318 | KeyTrans::loadAll(); |
319 | for (int i = 0; i < KeyTrans::count(); i++) | 319 | for (int i = 0; i < KeyTrans::count(); i++) |
320 | { KeyTrans* s = KeyTrans::find(i); | 320 | { KeyTrans* s = KeyTrans::find(i); |
321 | assert( s ); | 321 | assert( s ); |
322 | } | 322 | } |
323 | 323 | ||
324 | se_pgm = _pgm; | 324 | se_pgm = _pgm; |
325 | se_args = _args; | 325 | se_args = _args; |
326 | 326 | ||
327 | // read and apply default values /////////////////////////////////////////// | 327 | // read and apply default values /////////////////////////////////////////// |
328 | resize(321, 321); // Dummy. | 328 | resize(321, 321); // Dummy. |
329 | QSize currentSize = size(); | 329 | QSize currentSize = size(); |
330 | if (currentSize != size()) | 330 | if (currentSize != size()) |
331 | defaultSize = size(); | 331 | defaultSize = size(); |
332 | 332 | ||
333 | } | 333 | } |
334 | 334 | ||
335 | void Konsole::show() | 335 | void Konsole::show() |
336 | { | 336 | { |
337 | if ( !nsessions ) { | 337 | if ( !nsessions ) { |
338 | newSession(); | 338 | newSession(); |
339 | } | 339 | } |
340 | QMainWindow::show(); | 340 | QMainWindow::show(); |
341 | } | 341 | } |
342 | 342 | ||
343 | void Konsole::initSession(const char*, QStrList &) | 343 | void Konsole::initSession(const char*, QStrList &) |
344 | { | 344 | { |
345 | QMainWindow::show(); | 345 | QMainWindow::show(); |
346 | } | 346 | } |
347 | 347 | ||
348 | Konsole::~Konsole() | 348 | Konsole::~Konsole() |
349 | { | 349 | { |
350 | while (nsessions > 0) { | 350 | while (nsessions > 0) { |
351 | doneSession(getTe()->currentSession, 0); | 351 | doneSession(getTe()->currentSession, 0); |
352 | } | 352 | } |
353 | 353 | ||
354 | Config cfg("Konsole"); | 354 | Config cfg("Konsole"); |
355 | cfg.setGroup("Konsole"); | 355 | cfg.setGroup("Konsole"); |
356 | cfg.writeEntry("FontID", cfont); | 356 | cfg.writeEntry("FontID", cfont); |
357 | } | 357 | } |
358 | 358 | ||
359 | void Konsole::fontChanged(int f) | 359 | void Konsole::fontChanged(int f) |
360 | { | 360 | { |
361 | VTFont* font = fonts.at(f); | 361 | VTFont* font = fonts.at(f); |
362 | if (font != 0) { | 362 | if (font != 0) { |
363 | for(uint i = 0; i < fonts.count(); i++) { | 363 | for(uint i = 0; i < fonts.count(); i++) { |
364 | fontList->setItemChecked(i, (i == (uint) f) ? TRUE : FALSE); | 364 | fontList->setItemChecked(i, (i == (uint) f) ? TRUE : FALSE); |
365 | } | 365 | } |
366 | 366 | ||
367 | cfont = f; | 367 | cfont = f; |
368 | 368 | ||
369 | TEWidget* te = getTe(); | 369 | TEWidget* te = getTe(); |
370 | if (te != 0) { | 370 | if (te != 0) { |
371 | te->setVTFont(font->getFont()); | 371 | te->setVTFont(font->getFont()); |
372 | } | 372 | } |
373 | } | 373 | } |
374 | } | 374 | } |
375 | 375 | ||
376 | 376 | ||
377 | void Konsole::enterCommand(int c) | 377 | void Konsole::enterCommand(int c) |
378 | { | 378 | { |
379 | TEWidget* te = getTe(); | 379 | TEWidget* te = getTe(); |
380 | if (te != 0) { | 380 | if (te != 0) { |
381 | if(!commonCombo->editable()) { | 381 | if(!commonCombo->editable()) { |
382 | QString text = commonCombo->text(c); //commonCmds[c]; | 382 | QString text = commonCombo->text(c); //commonCmds[c]; |
383 | te->emitText(text); | 383 | te->emitText(text); |
384 | } else { | 384 | } else { |
385 | changeCommand( commonCombo->text(c), c); | 385 | changeCommand( commonCombo->text(c), c); |
386 | } | 386 | } |
387 | } | 387 | } |
388 | } | 388 | } |
389 | 389 | ||
390 | void Konsole::hitEnter() | 390 | void Konsole::hitEnter() |
391 | { | 391 | { |
392 | TEWidget* te = getTe(); | 392 | TEWidget* te = getTe(); |
393 | if (te != 0) { | 393 | if (te != 0) { |
394 | te->emitText(QString("\r")); | 394 | te->emitText(QString("\r")); |
395 | } | 395 | } |
396 | } | 396 | } |
397 | 397 | ||
398 | void Konsole::hitSpace() | 398 | void Konsole::hitSpace() |
399 | { | 399 | { |
400 | TEWidget* te = getTe(); | 400 | TEWidget* te = getTe(); |
401 | if (te != 0) { | 401 | if (te != 0) { |
402 | te->emitText(QString(" ")); | 402 | te->emitText(QString(" ")); |
403 | } | 403 | } |
404 | } | 404 | } |
405 | 405 | ||
406 | void Konsole::hitTab() | 406 | void Konsole::hitTab() |
407 | { | 407 | { |
408 | TEWidget* te = getTe(); | 408 | TEWidget* te = getTe(); |
409 | if (te != 0) { | 409 | if (te != 0) { |
410 | te->emitText(QString("\t")); | 410 | te->emitText(QString("\t")); |
411 | } | 411 | } |
412 | } | 412 | } |
413 | 413 | ||
414 | void Konsole::hitPaste() | 414 | void Konsole::hitPaste() |
415 | { | 415 | { |
416 | TEWidget* te = getTe(); | 416 | TEWidget* te = getTe(); |
417 | if (te != 0) { | 417 | if (te != 0) { |
418 | te->pasteClipboard(); | 418 | te->pasteClipboard(); |
419 | } | 419 | } |
420 | } | 420 | } |
421 | 421 | ||
422 | void Konsole::hitUp() | 422 | void Konsole::hitUp() |
423 | { | 423 | { |
424 | TEWidget* te = getTe(); | 424 | TEWidget* te = getTe(); |
425 | if (te != 0) { | 425 | if (te != 0) { |
426 | QKeyEvent ke( QKeyEvent::KeyPress, Qt::Key_Up, 0, 0); | 426 | QKeyEvent ke( QKeyEvent::KeyPress, Qt::Key_Up, 0, 0); |
427 | QApplication::sendEvent( te, &ke ); | 427 | QApplication::sendEvent( te, &ke ); |
428 | } | 428 | } |
429 | } | 429 | } |
430 | 430 | ||
431 | void Konsole::hitDown() | 431 | void Konsole::hitDown() |
432 | { | 432 | { |
433 | TEWidget* te = getTe(); | 433 | TEWidget* te = getTe(); |
434 | if (te != 0) { | 434 | if (te != 0) { |
435 | QKeyEvent ke( QKeyEvent::KeyPress, Qt::Key_Down, 0, 0); | 435 | QKeyEvent ke( QKeyEvent::KeyPress, Qt::Key_Down, 0, 0); |
436 | QApplication::sendEvent( te, &ke ); | 436 | QApplication::sendEvent( te, &ke ); |
437 | } | 437 | } |
438 | } | 438 | } |
439 | 439 | ||
440 | /** | 440 | /** |
441 | This function calculates the size of the external widget | 441 | This function calculates the size of the external widget |
442 | needed for the internal widget to be | 442 | needed for the internal widget to be |
443 | */ | 443 | */ |
444 | QSize Konsole::calcSize(int columns, int lines) { | 444 | QSize Konsole::calcSize(int columns, int lines) { |
445 | TEWidget* te = getTe(); | 445 | TEWidget* te = getTe(); |
446 | if (te != 0) { | 446 | if (te != 0) { |
447 | QSize size = te->calcSize(columns, lines); | 447 | QSize size = te->calcSize(columns, lines); |
448 | return size; | 448 | return size; |
449 | } else { | 449 | } else { |
450 | QSize size; | 450 | QSize size; |
451 | return size; | 451 | return size; |
452 | } | 452 | } |
453 | } | 453 | } |
454 | 454 | ||
455 | /** | 455 | /** |
456 | sets application window to a size based on columns X lines of the te | 456 | sets application window to a size based on columns X lines of the te |
457 | guest widget. Call with (0,0) for setting default size. | 457 | guest widget. Call with (0,0) for setting default size. |
458 | */ | 458 | */ |
459 | 459 | ||
460 | void Konsole::setColLin(int columns, int lines) | 460 | void Konsole::setColLin(int columns, int lines) |
461 | { | 461 | { |
462 | if ((columns==0) || (lines==0)) | 462 | if ((columns==0) || (lines==0)) |
463 | { | 463 | { |
464 | if (defaultSize.isEmpty()) // not in config file : set default value | 464 | if (defaultSize.isEmpty()) // not in config file : set default value |
465 | { | 465 | { |
466 | defaultSize = calcSize(80,24); | 466 | defaultSize = calcSize(80,24); |
467 | // notifySize(24,80); // set menu items (strange arg order !) | 467 | // notifySize(24,80); // set menu items (strange arg order !) |
468 | } | 468 | } |
469 | resize(defaultSize); | 469 | resize(defaultSize); |
470 | } else { | 470 | } else { |
471 | resize(calcSize(columns, lines)); | 471 | resize(calcSize(columns, lines)); |
472 | // notifySize(lines,columns); // set menu items (strange arg order !) | 472 | // notifySize(lines,columns); // set menu items (strange arg order !) |
473 | } | 473 | } |
474 | } | 474 | } |
475 | 475 | ||
476 | /* | 476 | /* |
477 | void Konsole::setFont(int fontno) | 477 | void Konsole::setFont(int fontno) |
478 | { | 478 | { |
479 | QFont f; | 479 | QFont f; |
480 | if (fontno == 0) | 480 | if (fontno == 0) |
481 | f = defaultFont = QFont( "Helvetica", 12 ); | 481 | f = defaultFont = QFont( "Helvetica", 12 ); |
482 | else | 482 | else |
483 | if (fonts[fontno][0] == '-') | 483 | if (fonts[fontno][0] == '-') |
484 | f.setRawName( fonts[fontno] ); | 484 | f.setRawName( fonts[fontno] ); |
485 | else | 485 | else |
486 | { | 486 | { |
487 | f.setFamily(fonts[fontno]); | 487 | f.setFamily(fonts[fontno]); |
488 | f.setRawMode( TRUE ); | 488 | f.setRawMode( TRUE ); |
489 | } | 489 | } |
490 | if ( !f.exactMatch() && fontno != 0) | 490 | if ( !f.exactMatch() && fontno != 0) |
491 | { | 491 | { |
492 | QString msg = i18n("Font `%1' not found.\nCheck README.linux.console for help.").arg(fonts[fontno]); | 492 | QString msg = i18n("Font `%1' not found.\nCheck README.linux.console for help.").arg(fonts[fontno]); |
493 | QMessageBox(this, msg); | 493 | QMessageBox(this, msg); |
494 | return; | 494 | return; |
495 | } | 495 | } |
496 | if (se) se->setFontNo(fontno); | 496 | if (se) se->setFontNo(fontno); |
497 | te->setVTFont(f); | 497 | te->setVTFont(f); |
498 | n_font = fontno; | 498 | n_font = fontno; |
499 | } | 499 | } |
500 | */ | 500 | */ |
501 | 501 | ||
502 | // --| color selection |------------------------------------------------------- | 502 | // --| color selection |------------------------------------------------------- |
503 | 503 | ||
504 | void Konsole::changeColumns(int columns) | 504 | void Konsole::changeColumns(int columns) |
505 | { | 505 | { |
506 | TEWidget* te = getTe(); | 506 | TEWidget* te = getTe(); |
507 | if (te != 0) { | 507 | if (te != 0) { |
508 | setColLin(columns,te->Lines()); | 508 | setColLin(columns,te->Lines()); |
509 | te->update(); | 509 | te->update(); |
510 | } | 510 | } |
511 | } | 511 | } |
512 | 512 | ||
513 | //FIXME: If a child dies during session swap, | 513 | //FIXME: If a child dies during session swap, |
514 | // this routine might be called before | 514 | // this routine might be called before |
515 | // session swap is completed. | 515 | // session swap is completed. |
516 | 516 | ||
517 | void Konsole::doneSession(TESession*, int ) | 517 | void Konsole::doneSession(TESession*, int ) |
518 | { | 518 | { |
519 | TEWidget *te = getTe(); | 519 | TEWidget *te = getTe(); |
520 | if (te != 0) { | 520 | if (te != 0) { |
521 | te->currentSession->setConnect(FALSE); | 521 | te->currentSession->setConnect(FALSE); |
522 | tab->removeTab(te); | 522 | tab->removeTab(te); |
523 | delete te->currentSession; | 523 | delete te->currentSession; |
524 | delete te; | 524 | delete te; |
525 | nsessions--; | 525 | nsessions--; |
526 | } | 526 | } |
527 | 527 | ||
528 | if (nsessions == 0) { | 528 | if (nsessions == 0) { |
529 | close(); | 529 | close(); |
530 | } | 530 | } |
531 | } | 531 | } |
532 | 532 | ||
533 | void Konsole::newSession() { | 533 | void Konsole::newSession() { |
534 | if(nsessions < 15) { // seems to be something weird about 16 tabs on the Zaurus.... memory? | 534 | if(nsessions < 15) { // seems to be something weird about 16 tabs on the Zaurus.... memory? |
535 | TEWidget* te = new TEWidget(tab); | 535 | TEWidget* te = new TEWidget(tab); |
536 | // te->setBackgroundMode(PaletteBase); //we want transparent!! | 536 | // te->setBackgroundMode(PaletteBase); //we want transparent!! |
537 | te->setVTFont(fonts.at(cfont)->getFont()); | 537 | te->setVTFont(fonts.at(cfont)->getFont()); |
538 | tab->addTab(te); | 538 | tab->addTab(te); |
539 | TESession* se = new TESession(this, te, se_pgm, se_args, "xterm"); | 539 | TESession* se = new TESession(this, te, se_pgm, se_args, "xterm"); |
540 | te->currentSession = se; | 540 | te->currentSession = se; |
541 | connect( se, SIGNAL(done(TESession*,int)), this, SLOT(doneSession(TESession*,int)) ); | 541 | connect( se, SIGNAL(done(TESession*,int)), this, SLOT(doneSession(TESession*,int)) ); |
542 | se->run(); | 542 | se->run(); |
543 | se->setConnect(TRUE); | 543 | se->setConnect(TRUE); |
544 | se->setHistory(b_scroll); | 544 | se->setHistory(b_scroll); |
545 | tab->setCurrentPage(nsessions); | 545 | tab->setCurrentPage(nsessions); |
546 | nsessions++; | 546 | nsessions++; |
547 | setColor(); | 547 | setColor(); |
548 | } | 548 | } |
549 | } | 549 | } |
550 | 550 | ||
551 | TEWidget* Konsole::getTe() { | 551 | TEWidget* Konsole::getTe() { |
552 | if (nsessions) { | 552 | if (nsessions) { |
553 | return (TEWidget *) tab->currentPage(); | 553 | return (TEWidget *) tab->currentPage(); |
554 | } else { | 554 | } else { |
555 | return 0; | 555 | return 0; |
556 | } | 556 | } |
557 | } | 557 | } |
558 | 558 | ||
559 | void Konsole::switchSession(QWidget* w) { | 559 | void Konsole::switchSession(QWidget* w) { |
560 | TEWidget* te = (TEWidget *) w; | 560 | TEWidget* te = (TEWidget *) w; |
561 | 561 | ||
562 | QFont teFnt = te->getVTFont(); | 562 | QFont teFnt = te->getVTFont(); |
563 | for(uint i = 0; i < fonts.count(); i++) { | 563 | for(uint i = 0; i < fonts.count(); i++) { |
564 | VTFont *fnt = fonts.at(i); | 564 | VTFont *fnt = fonts.at(i); |
565 | bool cf = fnt->getFont() == teFnt; | 565 | bool cf = fnt->getFont() == teFnt; |
566 | fontList->setItemChecked(i, cf); | 566 | fontList->setItemChecked(i, cf); |
567 | if (cf) { | 567 | if (cf) { |
568 | cfont = i; | 568 | cfont = i; |
569 | } | 569 | } |
570 | } | 570 | } |
571 | } | 571 | } |
572 | 572 | ||
573 | /// ------------------------------- some new stuff by L.J. Potter | 573 | /// ------------------------------- some new stuff by L.J. Potter |
574 | void Konsole::colorMenuSelected(int iD) | 574 | void Konsole::colorMenuSelected(int iD) |
575 | { // this is NOT pretty, elegant or anything else besides functional | 575 | { // this is NOT pretty, elegant or anything else besides functional |
576 | // QString temp; | 576 | // QString temp; |
577 | // temp.sprintf("%d", iD); | 577 | // temp.sprintf("%d", iD); |
578 | // qDebug(temp); | 578 | // qDebug(temp); |
579 | TEWidget* te = getTe(); | 579 | TEWidget* te = getTe(); |
580 | Config cfg("Konsole"); | 580 | Config cfg("Konsole"); |
581 | cfg.setGroup("Colors"); | 581 | cfg.setGroup("Colors"); |
582 | QColor foreground; | 582 | QColor foreground; |
583 | QColor background; | 583 | QColor background; |
584 | colorMenu->setItemChecked(lastSelectedMenu,FALSE); | 584 | colorMenu->setItemChecked(lastSelectedMenu,FALSE); |
585 | ColorEntry m_table[TABLE_COLORS]; | 585 | ColorEntry m_table[TABLE_COLORS]; |
586 | const ColorEntry * defaultCt=te->getdefaultColorTable(); | 586 | const ColorEntry * defaultCt=te->getdefaultColorTable(); |
587 | /////////// fore back | 587 | /////////// fore back |
588 | int i; | 588 | int i; |
589 | if(iD==-8) { // default default | 589 | if(iD==-8) { // default default |
590 | for (i = 0; i < TABLE_COLORS; i++) { | 590 | for (i = 0; i < TABLE_COLORS; i++) { |
591 | m_table[i].color = defaultCt[i].color; | 591 | m_table[i].color = defaultCt[i].color; |
592 | if(i==1 || i == 11) | 592 | if(i==1 || i == 11) |
593 | m_table[i].transparent=1; | 593 | m_table[i].transparent=1; |
594 | cfg.writeEntry("Schema","8"); | 594 | cfg.writeEntry("Schema","8"); |
595 | colorMenu->setItemChecked(-8,TRUE); | 595 | colorMenu->setItemChecked(-8,TRUE); |
596 | } | 596 | } |
597 | } else { | 597 | } else { |
598 | if(iD==-5) { // green black | 598 | if(iD==-5) { // green black |
599 | foreground.setRgb(0x18,255,0x18); | 599 | foreground.setRgb(0x18,255,0x18); |
600 | background.setRgb(0x00,0x00,0x00); | 600 | background.setRgb(0x00,0x00,0x00); |
601 | cfg.writeEntry("Schema","5"); | 601 | cfg.writeEntry("Schema","5"); |
602 | colorMenu->setItemChecked(-5,TRUE); | 602 | colorMenu->setItemChecked(-5,TRUE); |
603 | } | 603 | } |
604 | if(iD==-6) { // black white | 604 | if(iD==-6) { // black white |
605 | foreground.setRgb(0x00,0x00,0x00); | 605 | foreground.setRgb(0x00,0x00,0x00); |
606 | background.setRgb(0xFF,0xFF,0xFF); | 606 | background.setRgb(0xFF,0xFF,0xFF); |
607 | cfg.writeEntry("Schema","6"); | 607 | cfg.writeEntry("Schema","6"); |
608 | colorMenu->setItemChecked(-6,TRUE); | 608 | colorMenu->setItemChecked(-6,TRUE); |
609 | } | 609 | } |
610 | if(iD==-7) { // white black | 610 | if(iD==-7) { // white black |
611 | foreground.setRgb(0xFF,0xFF,0xFF); | 611 | foreground.setRgb(0xFF,0xFF,0xFF); |
612 | background.setRgb(0x00,0x00,0x00); | 612 | background.setRgb(0x00,0x00,0x00); |
613 | cfg.writeEntry("Schema","7"); | 613 | cfg.writeEntry("Schema","7"); |
614 | colorMenu->setItemChecked(-7,TRUE); | 614 | colorMenu->setItemChecked(-7,TRUE); |
615 | } | 615 | } |
616 | if(iD==-9) {// Black, Red | 616 | if(iD==-9) {// Black, Red |
617 | foreground.setRgb(0x00,0x00,0x00); | 617 | foreground.setRgb(0x00,0x00,0x00); |
618 | background.setRgb(0xB2,0x18,0x18); | 618 | background.setRgb(0xB2,0x18,0x18); |
619 | cfg.writeEntry("Schema","9"); | 619 | cfg.writeEntry("Schema","9"); |
620 | colorMenu->setItemChecked(-9,TRUE); | 620 | colorMenu->setItemChecked(-9,TRUE); |
621 | } | 621 | } |
622 | if(iD==-10) {// Red, Black | 622 | if(iD==-10) {// Red, Black |
623 | foreground.setRgb(230,31,31); //0xB2,0x18,0x18 | 623 | foreground.setRgb(230,31,31); //0xB2,0x18,0x18 |
624 | background.setRgb(0x00,0x00,0x00); | 624 | background.setRgb(0x00,0x00,0x00); |
625 | cfg.writeEntry("Schema","10"); | 625 | cfg.writeEntry("Schema","10"); |
626 | colorMenu->setItemChecked(-10,TRUE); | 626 | colorMenu->setItemChecked(-10,TRUE); |
627 | } | 627 | } |
628 | if(iD==-11) {// Green, Yellow - is ugly | 628 | if(iD==-11) {// Green, Yellow - is ugly |
629 | // foreground.setRgb(0x18,0xB2,0x18); | 629 | // foreground.setRgb(0x18,0xB2,0x18); |
630 | foreground.setRgb(36,139,10); | 630 | foreground.setRgb(36,139,10); |
631 | // background.setRgb(0xB2,0x68,0x18); | 631 | // background.setRgb(0xB2,0x68,0x18); |
632 | background.setRgb(255,255,0); | 632 | background.setRgb(255,255,0); |
633 | cfg.writeEntry("Schema","11"); | 633 | cfg.writeEntry("Schema","11"); |
634 | colorMenu->setItemChecked(-11,TRUE); | 634 | colorMenu->setItemChecked(-11,TRUE); |
635 | } | 635 | } |
636 | if(iD==-12) {// Blue, Magenta | 636 | if(iD==-12) {// Blue, Magenta |
637 | foreground.setRgb(0x18,0xB2,0xB2); | 637 | foreground.setRgb(0x18,0xB2,0xB2); |
638 | background.setRgb(0x18,0x18,0xB2); | 638 | background.setRgb(0x18,0x18,0xB2); |
639 | cfg.writeEntry("Schema","12"); | 639 | cfg.writeEntry("Schema","12"); |
640 | colorMenu->setItemChecked(-12,TRUE); | 640 | colorMenu->setItemChecked(-12,TRUE); |
641 | } | 641 | } |
642 | if(iD==-13) {// Magenta, Blue | 642 | if(iD==-13) {// Magenta, Blue |
643 | foreground.setRgb(0x18,0x18,0xB2); | 643 | foreground.setRgb(0x18,0x18,0xB2); |
644 | background.setRgb(0x18,0xB2,0xB2); | 644 | background.setRgb(0x18,0xB2,0xB2); |
645 | cfg.writeEntry("Schema","13"); | 645 | cfg.writeEntry("Schema","13"); |
646 | colorMenu->setItemChecked(-13,TRUE); | 646 | colorMenu->setItemChecked(-13,TRUE); |
647 | } | 647 | } |
648 | if(iD==-14) {// Cyan, White | 648 | if(iD==-14) {// Cyan, White |
649 | foreground.setRgb(0x18,0xB2,0xB2); | 649 | foreground.setRgb(0x18,0xB2,0xB2); |
650 | background.setRgb(0xFF,0xFF,0xFF); | 650 | background.setRgb(0xFF,0xFF,0xFF); |
651 | cfg.writeEntry("Schema","14"); | 651 | cfg.writeEntry("Schema","14"); |
652 | colorMenu->setItemChecked(-14,TRUE); | 652 | colorMenu->setItemChecked(-14,TRUE); |
653 | } | 653 | } |
654 | if(iD==-15) {// White, Cyan | 654 | if(iD==-15) {// White, Cyan |
655 | background.setRgb(0x18,0xB2,0xB2); | 655 | background.setRgb(0x18,0xB2,0xB2); |
656 | foreground.setRgb(0xFF,0xFF,0xFF); | 656 | foreground.setRgb(0xFF,0xFF,0xFF); |
657 | cfg.writeEntry("Schema","15"); | 657 | cfg.writeEntry("Schema","15"); |
658 | colorMenu->setItemChecked(-15,TRUE); | 658 | colorMenu->setItemChecked(-15,TRUE); |
659 | } | 659 | } |
660 | if(iD==-16) {// Black, Blue | 660 | if(iD==-16) {// Black, Blue |
661 | background.setRgb(0x00,0x00,0x00); | 661 | background.setRgb(0x00,0x00,0x00); |
662 | foreground.setRgb(0x18,0xB2,0xB2); | 662 | foreground.setRgb(0x18,0xB2,0xB2); |
663 | cfg.writeEntry("Schema","16"); | 663 | cfg.writeEntry("Schema","16"); |
664 | colorMenu->setItemChecked(-16,TRUE); | 664 | colorMenu->setItemChecked(-16,TRUE); |
665 | } | 665 | } |
666 | 666 | ||
667 | for (i = 0; i < TABLE_COLORS; i++) { | 667 | for (i = 0; i < TABLE_COLORS; i++) { |
668 | if(i==0 || i == 10) { | 668 | if(i==0 || i == 10) { |
669 | m_table[i].color = foreground; | 669 | m_table[i].color = foreground; |
670 | } | 670 | } |
671 | else if(i==1 || i == 11) { | 671 | else if(i==1 || i == 11) { |
672 | m_table[i].color = background; m_table[i].transparent=0; | 672 | m_table[i].color = background; m_table[i].transparent=0; |
673 | } | 673 | } |
674 | else | 674 | else |
675 | m_table[i].color = defaultCt[i].color; | 675 | m_table[i].color = defaultCt[i].color; |
676 | } | 676 | } |
677 | } | 677 | } |
678 | lastSelectedMenu = iD; | 678 | lastSelectedMenu = iD; |
679 | te->setColorTable(m_table); | 679 | te->setColorTable(m_table); |
680 | // update(); | 680 | update(); |
681 | } | 681 | } |
682 | 682 | ||
683 | void Konsole::configMenuSelected(int iD) | 683 | void Konsole::configMenuSelected(int iD) |
684 | { | 684 | { |
685 | // QString temp; | 685 | // QString temp; |
686 | // temp.sprintf("%d",iD); | 686 | // temp.sprintf("%d",iD); |
687 | // qDebug(temp); | 687 | // qDebug(temp); |
688 | TEWidget* te = getTe(); | 688 | TEWidget* te = getTe(); |
689 | Config cfg("Konsole"); | 689 | Config cfg("Konsole"); |
690 | cfg.setGroup("Menubar"); | 690 | cfg.setGroup("Menubar"); |
691 | if( iD == -2) { | 691 | if( iD == -2) { |
692 | if(!secondToolBar->isHidden()) { | 692 | if(!secondToolBar->isHidden()) { |
693 | secondToolBar->hide(); | 693 | secondToolBar->hide(); |
694 | configMenu->changeItem( iD,"Show Command List"); | 694 | configMenu->changeItem( iD,"Show Command List"); |
695 | cfg.writeEntry("Hidden","TRUE"); | 695 | cfg.writeEntry("Hidden","TRUE"); |
696 | configMenu->setItemEnabled(-20 ,FALSE); | 696 | configMenu->setItemEnabled(-20 ,FALSE); |
697 | } else { | 697 | } else { |
698 | secondToolBar->show(); | 698 | secondToolBar->show(); |
699 | configMenu->changeItem( iD,"Hide Command List"); | 699 | configMenu->changeItem( iD,"Hide Command List"); |
700 | cfg.writeEntry("Hidden","FALSE"); | 700 | cfg.writeEntry("Hidden","FALSE"); |
701 | configMenu->setItemEnabled(-20 ,TRUE); | 701 | configMenu->setItemEnabled(-20 ,TRUE); |
702 | 702 | ||
703 | if(cfg.readEntry("EditEnabled","FALSE")=="TRUE") { | 703 | if(cfg.readEntry("EditEnabled","FALSE")=="TRUE") { |
704 | configMenu->setItemChecked(-16,TRUE); | 704 | configMenu->setItemChecked(-16,TRUE); |
705 | commonCombo->setEditable( TRUE ); | 705 | commonCombo->setEditable( TRUE ); |
706 | } else { | 706 | } else { |
707 | configMenu->setItemChecked(-20,FALSE); | 707 | configMenu->setItemChecked(-20,FALSE); |
708 | commonCombo->setEditable( FALSE ); | 708 | commonCombo->setEditable( FALSE ); |
709 | } | 709 | } |
710 | } | 710 | } |
711 | } | 711 | } |
712 | if( iD == -3) { | 712 | if( iD == -3) { |
713 | cfg.setGroup("Tabs"); | 713 | cfg.setGroup("Tabs"); |
714 | QString tmp=cfg.readEntry("Position","Top"); | 714 | QString tmp=cfg.readEntry("Position","Top"); |
715 | 715 | ||
716 | if(tmp=="Top") { | 716 | if(tmp=="Top") { |
717 | tab->setTabPosition(QTabWidget::Bottom); | 717 | tab->setTabPosition(QTabWidget::Bottom); |
718 | configMenu->changeItem( iD,"Tabs on Top"); | 718 | configMenu->changeItem( iD,"Tabs on Top"); |
719 | cfg.writeEntry("Position","Bottom"); | 719 | cfg.writeEntry("Position","Bottom"); |
720 | } else { | 720 | } else { |
721 | tab->setTabPosition(QTabWidget::Top); | 721 | tab->setTabPosition(QTabWidget::Top); |
722 | configMenu->changeItem( iD,"Tabs on Bottom"); | 722 | configMenu->changeItem( iD,"Tabs on Bottom"); |
723 | cfg.writeEntry("Position","Top"); | 723 | cfg.writeEntry("Position","Top"); |
724 | } | 724 | } |
725 | } | 725 | } |
726 | if( iD == -20) { | 726 | if( iD == -20) { |
727 | cfg.setGroup("Commands"); | 727 | cfg.setGroup("Commands"); |
728 | // qDebug("enableCommandEdit"); | 728 | // qDebug("enableCommandEdit"); |
729 | if( !configMenu->isItemChecked(iD) ) { | 729 | if( !configMenu->isItemChecked(iD) ) { |
730 | commonCombo->setEditable( TRUE ); | 730 | commonCombo->setEditable( TRUE ); |
731 | configMenu->setItemChecked(iD,TRUE); | 731 | configMenu->setItemChecked(iD,TRUE); |
732 | commonCombo->setCurrentItem(0); | 732 | commonCombo->setCurrentItem(0); |
733 | cfg.writeEntry("EditEnabled","TRUE"); | 733 | cfg.writeEntry("EditEnabled","TRUE"); |
734 | } else { | 734 | } else { |
735 | commonCombo->setEditable( FALSE ); | 735 | commonCombo->setEditable( FALSE ); |
736 | configMenu->setItemChecked(iD,FALSE); | 736 | configMenu->setItemChecked(iD,FALSE); |
737 | cfg.writeEntry("EditEnabled","FALSE"); | 737 | cfg.writeEntry("EditEnabled","FALSE"); |
738 | commonCombo->setFocusPolicy(QWidget::NoFocus); | 738 | commonCombo->setFocusPolicy(QWidget::NoFocus); |
739 | te->setFocus(); | 739 | te->setFocus(); |
740 | } | 740 | } |
741 | } | 741 | } |
742 | } | 742 | } |
743 | 743 | ||
744 | void Konsole::changeCommand(const QString &text, int c) | 744 | void Konsole::changeCommand(const QString &text, int c) |
745 | { | 745 | { |
746 | Config cfg("Konsole"); | 746 | Config cfg("Konsole"); |
747 | cfg.setGroup("Commands"); | 747 | cfg.setGroup("Commands"); |
748 | if(commonCmds[c] != text) { | 748 | if(commonCmds[c] != text) { |
749 | cfg.writeEntry(QString::number(c),text); | 749 | cfg.writeEntry(QString::number(c),text); |
750 | commonCombo->clearEdit(); | 750 | commonCombo->clearEdit(); |
751 | commonCombo->setCurrentItem(c); | 751 | commonCombo->setCurrentItem(c); |
752 | } | 752 | } |
753 | } | 753 | } |
754 | 754 | ||
755 | void Konsole::setColor() | 755 | void Konsole::setColor() |
756 | { | 756 | { |
757 | Config cfg("Konsole"); | 757 | Config cfg("Konsole"); |
758 | cfg.setGroup("Colors"); | 758 | cfg.setGroup("Colors"); |
759 | int scheme = cfg.readNumEntry("Schema",1); | 759 | int scheme = cfg.readNumEntry("Schema",1); |
760 | if(scheme != 1) colorMenuSelected( -scheme); | 760 | if(scheme != 1) colorMenuSelected( -scheme); |
761 | 761 | ||
762 | } | 762 | } |