-rw-r--r-- | core/apps/embeddedkonsole/konsole.cpp | 3 |
1 files changed, 1 insertions, 2 deletions
diff --git a/core/apps/embeddedkonsole/konsole.cpp b/core/apps/embeddedkonsole/konsole.cpp index adcfb7f..f13d0c9 100644 --- a/core/apps/embeddedkonsole/konsole.cpp +++ b/core/apps/embeddedkonsole/konsole.cpp | |||
@@ -1,364 +1,363 @@ | |||
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 | // enhancements added by L.J. Potter <ljp@llornkcor.com> | 21 | // enhancements added by L.J. Potter <ljp@llornkcor.com> |
22 | 22 | ||
23 | #include <qpe/resource.h> | 23 | #include <qpe/resource.h> |
24 | 24 | ||
25 | #include <qdir.h> | 25 | #include <qdir.h> |
26 | #include <qevent.h> | 26 | #include <qevent.h> |
27 | #include <qdragobject.h> | 27 | #include <qdragobject.h> |
28 | #include <qobjectlist.h> | 28 | #include <qobjectlist.h> |
29 | #include <qtoolbutton.h> | 29 | #include <qtoolbutton.h> |
30 | #include <qpe/qpetoolbar.h> | 30 | #include <qpe/qpetoolbar.h> |
31 | #include <qpushbutton.h> | 31 | #include <qpushbutton.h> |
32 | #include <qfontdialog.h> | 32 | #include <qfontdialog.h> |
33 | #include <qglobal.h> | 33 | #include <qglobal.h> |
34 | #include <qpainter.h> | 34 | #include <qpainter.h> |
35 | #include <qpe/qpemenubar.h> | 35 | #include <qpe/qpemenubar.h> |
36 | #include <qmessagebox.h> | 36 | #include <qmessagebox.h> |
37 | #include <qaction.h> | 37 | #include <qaction.h> |
38 | #include <qapplication.h> | 38 | #include <qapplication.h> |
39 | #include <qfontmetrics.h> | 39 | #include <qfontmetrics.h> |
40 | #include <qcombobox.h> | 40 | #include <qcombobox.h> |
41 | #include <qevent.h> | 41 | #include <qevent.h> |
42 | #include <qtabwidget.h> | 42 | #include <qtabwidget.h> |
43 | #include <qtabbar.h> | 43 | #include <qtabbar.h> |
44 | #include <qpe/config.h> | 44 | #include <qpe/config.h> |
45 | #include <qstringlist.h> | 45 | #include <qstringlist.h> |
46 | #include <qpalette.h> | 46 | #include <qpalette.h> |
47 | 47 | ||
48 | #include <sys/wait.h> | 48 | #include <sys/wait.h> |
49 | #include <stdio.h> | 49 | #include <stdio.h> |
50 | #include <stdlib.h> | 50 | #include <stdlib.h> |
51 | #include <assert.h> | 51 | #include <assert.h> |
52 | 52 | ||
53 | #include "konsole.h" | 53 | #include "konsole.h" |
54 | #include "keytrans.h" | 54 | #include "keytrans.h" |
55 | #include "commandeditdialog.h" | 55 | #include "commandeditdialog.h" |
56 | 56 | ||
57 | class EKNumTabBar : public QTabBar { | 57 | class EKNumTabBar : public QTabBar { |
58 | public: | 58 | public: |
59 | void numberTabs() | 59 | void numberTabs() |
60 | { | 60 | { |
61 | // Yes, it really is this messy. QTabWidget needs functions | 61 | // Yes, it really is this messy. QTabWidget needs functions |
62 | // that provide acces to tabs in a sequential way. | 62 | // that provide acces to tabs in a sequential way. |
63 | int m=INT_MIN; | 63 | int m=INT_MIN; |
64 | for (int i=0; i<count(); i++) { | 64 | for (int i=0; i<count(); i++) { |
65 | QTab* left=0; | 65 | QTab* left=0; |
66 | QListIterator<QTab> it(*tabList()); | 66 | QListIterator<QTab> it(*tabList()); |
67 | int x=INT_MAX; | 67 | int x=INT_MAX; |
68 | for( QTab* t; (t=it.current()); ++it ) { | 68 | for( QTab* t; (t=it.current()); ++it ) { |
69 | int tx = t->rect().x(); | 69 | int tx = t->rect().x(); |
70 | if ( tx<x && tx>m ) { | 70 | if ( tx<x && tx>m ) { |
71 | x = tx; | 71 | x = tx; |
72 | left = t; | 72 | left = t; |
73 | } | 73 | } |
74 | } | 74 | } |
75 | if ( left ) { | 75 | if ( left ) { |
76 | left->setText(QString::number(i+1)); | 76 | left->setText(QString::number(i+1)); |
77 | m = left->rect().x(); | 77 | m = left->rect().x(); |
78 | } | 78 | } |
79 | } | 79 | } |
80 | } | 80 | } |
81 | }; | 81 | }; |
82 | 82 | ||
83 | class EKNumTabWidget : public QTabWidget { | 83 | class EKNumTabWidget : public QTabWidget { |
84 | public: | 84 | public: |
85 | EKNumTabWidget(QWidget* parent) : QTabWidget(parent) | 85 | EKNumTabWidget(QWidget* parent) : QTabWidget(parent) |
86 | { | 86 | { |
87 | } | 87 | } |
88 | 88 | ||
89 | void addTab(QWidget* w) | 89 | void addTab(QWidget* w) |
90 | { | 90 | { |
91 | QTab* t = new QTab(QString::number(tabBar()->count()+1)); | 91 | QTab* t = new QTab(QString::number(tabBar()->count()+1)); |
92 | QTabWidget::addTab(w,t); | 92 | QTabWidget::addTab(w,t); |
93 | } | 93 | } |
94 | 94 | ||
95 | void removeTab(QWidget* w) | 95 | void removeTab(QWidget* w) |
96 | { | 96 | { |
97 | removePage(w); | 97 | removePage(w); |
98 | ((EKNumTabBar*)tabBar())->numberTabs(); | 98 | ((EKNumTabBar*)tabBar())->numberTabs(); |
99 | } | 99 | } |
100 | }; | 100 | }; |
101 | 101 | ||
102 | // This could be configurable or dynamicly generated from the bash history | 102 | // This could be configurable or dynamicly generated from the bash history |
103 | // file of the user | 103 | // file of the user |
104 | static const char *commonCmds[] = | 104 | static const char *commonCmds[] = |
105 | { | 105 | { |
106 | "ls ", // I left this here, cause it looks better than the first alpha | 106 | "ls ", // I left this here, cause it looks better than the first alpha |
107 | "cardctl eject", | 107 | "cardctl eject", |
108 | "cat ", | 108 | "cat ", |
109 | "cd ", | 109 | "cd ", |
110 | "chmod ", | 110 | "chmod ", |
111 | "clear", | 111 | "clear", |
112 | "cp ", | 112 | "cp ", |
113 | "dc ", | 113 | "dc ", |
114 | "df ", | 114 | "df ", |
115 | "dmesg", | 115 | "dmesg", |
116 | "echo ", | 116 | "echo ", |
117 | "env", | 117 | "env", |
118 | "find ", | 118 | "find ", |
119 | "free", | 119 | "free", |
120 | "grep ", | 120 | "grep ", |
121 | "ifconfig ", | 121 | "ifconfig ", |
122 | "ipkg ", | 122 | "ipkg ", |
123 | "mkdir ", | 123 | "mkdir ", |
124 | "mv ", | 124 | "mv ", |
125 | "nc localhost 7776", | 125 | "nc localhost 7776", |
126 | "nc localhost 7777", | 126 | "nc localhost 7777", |
127 | "netstat ", | 127 | "netstat ", |
128 | "nslookup ", | 128 | "nslookup ", |
129 | "ping ", | 129 | "ping ", |
130 | "ps aux", | 130 | "ps aux", |
131 | "pwd ", | 131 | "pwd ", |
132 | "rm ", | 132 | "rm ", |
133 | "rmdir ", | 133 | "rmdir ", |
134 | "route ", | 134 | "route ", |
135 | "set ", | 135 | "set ", |
136 | "traceroute", | 136 | "traceroute", |
137 | 137 | ||
138 | /* | 138 | /* |
139 | "gzip", | 139 | "gzip", |
140 | "gunzip", | 140 | "gunzip", |
141 | "chgrp", | 141 | "chgrp", |
142 | "chown", | 142 | "chown", |
143 | "date", | 143 | "date", |
144 | "dd", | 144 | "dd", |
145 | "df", | 145 | "df", |
146 | "dmesg", | 146 | "dmesg", |
147 | "fuser", | 147 | "fuser", |
148 | "hostname", | 148 | "hostname", |
149 | "kill", | 149 | "kill", |
150 | "killall", | 150 | "killall", |
151 | "ln", | 151 | "ln", |
152 | "ping", | 152 | "ping", |
153 | "mount", | 153 | "mount", |
154 | "more", | 154 | "more", |
155 | "sort", | 155 | "sort", |
156 | "touch", | 156 | "touch", |
157 | "umount", | 157 | "umount", |
158 | "mknod", | 158 | "mknod", |
159 | "netstat", | 159 | "netstat", |
160 | */ | 160 | */ |
161 | 161 | ||
162 | "exit", | 162 | "exit", |
163 | NULL | 163 | NULL |
164 | }; | 164 | }; |
165 | 165 | ||
166 | 166 | ||
167 | Konsole::Konsole(QWidget* parent, const char* name, WFlags fl) : | 167 | Konsole::Konsole(QWidget* parent, const char* name, WFlags fl) : |
168 | QMainWindow(parent, name, fl) | 168 | QMainWindow(parent, name, fl) |
169 | { | 169 | { |
170 | QStrList args; | 170 | QStrList args; |
171 | init("/bin/ash",args); | 171 | init("/bin/sh",args); |
172 | // init("/bin/sh",args); | ||
173 | } | 172 | } |
174 | 173 | ||
175 | Konsole::Konsole(const char* name, const char* _pgm, QStrList & _args, int) | 174 | Konsole::Konsole(const char* name, const char* _pgm, QStrList & _args, int) |
176 | : QMainWindow(0, name) | 175 | : QMainWindow(0, name) |
177 | { | 176 | { |
178 | init(_pgm,_args); | 177 | init(_pgm,_args); |
179 | } | 178 | } |
180 | 179 | ||
181 | void Konsole::initCommandList() | 180 | void Konsole::initCommandList() |
182 | { | 181 | { |
183 | // qDebug("Konsole::initCommandList"); | 182 | // qDebug("Konsole::initCommandList"); |
184 | Config cfg("Konsole"); | 183 | Config cfg("Konsole"); |
185 | cfg.setGroup("Commands"); | 184 | cfg.setGroup("Commands"); |
186 | commonCombo->setInsertionPolicy(QComboBox::AtCurrent); | 185 | commonCombo->setInsertionPolicy(QComboBox::AtCurrent); |
187 | commonCombo->clear(); | 186 | commonCombo->clear(); |
188 | if (cfg.readEntry("Commands Set","FALSE") == "FALSE") { | 187 | if (cfg.readEntry("Commands Set","FALSE") == "FALSE") { |
189 | for (int i = 0; commonCmds[i] != NULL; i++) { | 188 | for (int i = 0; commonCmds[i] != NULL; i++) { |
190 | commonCombo->insertItem(commonCmds[i],i); | 189 | commonCombo->insertItem(commonCmds[i],i); |
191 | } | 190 | } |
192 | } else { | 191 | } else { |
193 | for (int i = 0; i < 100; i++) { | 192 | for (int i = 0; i < 100; i++) { |
194 | if (!(cfg.readEntry( QString::number(i),"")).isEmpty()) | 193 | if (!(cfg.readEntry( QString::number(i),"")).isEmpty()) |
195 | commonCombo->insertItem((cfg.readEntry( QString::number(i),""))); | 194 | commonCombo->insertItem((cfg.readEntry( QString::number(i),""))); |
196 | } | 195 | } |
197 | } | 196 | } |
198 | 197 | ||
199 | } | 198 | } |
200 | 199 | ||
201 | void Konsole::init(const char* _pgm, QStrList & _args) | 200 | void Konsole::init(const char* _pgm, QStrList & _args) |
202 | { | 201 | { |
203 | b_scroll = TRUE; // histon; | 202 | b_scroll = TRUE; // histon; |
204 | n_keytab = 0; | 203 | n_keytab = 0; |
205 | n_render = 0; | 204 | n_render = 0; |
206 | startUp=0; | 205 | startUp=0; |
207 | setCaption( tr("Terminal") ); | 206 | setCaption( tr("Terminal") ); |
208 | setIcon( Resource::loadPixmap( "konsole" ) ); | 207 | setIcon( Resource::loadPixmap( "konsole" ) ); |
209 | 208 | ||
210 | Config cfg("Konsole"); | 209 | Config cfg("Konsole"); |
211 | cfg.setGroup("Konsole"); | 210 | cfg.setGroup("Konsole"); |
212 | QString tmp; | 211 | QString tmp; |
213 | // initialize the list of allowed fonts /////////////////////////////////// | 212 | // initialize the list of allowed fonts /////////////////////////////////// |
214 | cfont = cfg.readNumEntry("FontID", 1); | 213 | cfont = cfg.readNumEntry("FontID", 1); |
215 | QFont f = QFont("Micro", 4, QFont::Normal); | 214 | QFont f = QFont("Micro", 4, QFont::Normal); |
216 | f.setFixedPitch(TRUE); | 215 | f.setFixedPitch(TRUE); |
217 | fonts.append(new VTFont(tr("Micro"), f)); | 216 | fonts.append(new VTFont(tr("Micro"), f)); |
218 | 217 | ||
219 | f = QFont("Fixed", 7, QFont::Normal); | 218 | f = QFont("Fixed", 7, QFont::Normal); |
220 | f.setFixedPitch(TRUE); | 219 | f.setFixedPitch(TRUE); |
221 | fonts.append(new VTFont(tr("Small Fixed"), f)); | 220 | fonts.append(new VTFont(tr("Small Fixed"), f)); |
222 | 221 | ||
223 | f = QFont("Fixed", 12, QFont::Normal); | 222 | f = QFont("Fixed", 12, QFont::Normal); |
224 | f.setFixedPitch(TRUE); | 223 | f.setFixedPitch(TRUE); |
225 | fonts.append(new VTFont(tr("Medium Fixed"), f)); | 224 | fonts.append(new VTFont(tr("Medium Fixed"), f)); |
226 | 225 | ||
227 | // create terminal emulation framework //////////////////////////////////// | 226 | // create terminal emulation framework //////////////////////////////////// |
228 | nsessions = 0; | 227 | nsessions = 0; |
229 | 228 | ||
230 | tab = new EKNumTabWidget(this); | 229 | tab = new EKNumTabWidget(this); |
231 | 230 | ||
232 | connect(tab, SIGNAL(currentChanged(QWidget*)), this, SLOT(switchSession(QWidget*))); | 231 | connect(tab, SIGNAL(currentChanged(QWidget*)), this, SLOT(switchSession(QWidget*))); |
233 | 232 | ||
234 | // create terminal toolbar //////////////////////////////////////////////// | 233 | // create terminal toolbar //////////////////////////////////////////////// |
235 | setToolBarsMovable( FALSE ); | 234 | setToolBarsMovable( FALSE ); |
236 | QPEToolBar *menuToolBar = new QPEToolBar( this ); | 235 | QPEToolBar *menuToolBar = new QPEToolBar( this ); |
237 | menuToolBar->setHorizontalStretchable( TRUE ); | 236 | menuToolBar->setHorizontalStretchable( TRUE ); |
238 | 237 | ||
239 | QPEMenuBar *menuBar = new QPEMenuBar( menuToolBar ); | 238 | QPEMenuBar *menuBar = new QPEMenuBar( menuToolBar ); |
240 | 239 | ||
241 | fontList = new QPopupMenu( this ); | 240 | fontList = new QPopupMenu( this ); |
242 | for(uint i = 0; i < fonts.count(); i++) { | 241 | for(uint i = 0; i < fonts.count(); i++) { |
243 | VTFont *fnt = fonts.at(i); | 242 | VTFont *fnt = fonts.at(i); |
244 | fontList->insertItem(fnt->getName(), i); | 243 | fontList->insertItem(fnt->getName(), i); |
245 | } | 244 | } |
246 | fontChanged(cfont); | 245 | fontChanged(cfont); |
247 | 246 | ||
248 | configMenu = new QPopupMenu( this); | 247 | configMenu = new QPopupMenu( this); |
249 | colorMenu = new QPopupMenu( this); | 248 | colorMenu = new QPopupMenu( this); |
250 | scrollMenu = new QPopupMenu( this); | 249 | scrollMenu = new QPopupMenu( this); |
251 | editCommandListMenu = new QPopupMenu( this); | 250 | editCommandListMenu = new QPopupMenu( this); |
252 | 251 | ||
253 | configMenu->insertItem("Command List",editCommandListMenu); | 252 | configMenu->insertItem("Command List",editCommandListMenu); |
254 | 253 | ||
255 | bool listHidden; | 254 | bool listHidden; |
256 | cfg.setGroup("Menubar"); | 255 | cfg.setGroup("Menubar"); |
257 | if( cfg.readEntry("Hidden","FALSE") == "TRUE") { | 256 | if( cfg.readEntry("Hidden","FALSE") == "TRUE") { |
258 | editCommandListMenu->insertItem( tr( "Show command list" )); | 257 | editCommandListMenu->insertItem( tr( "Show command list" )); |
259 | listHidden=TRUE; | 258 | listHidden=TRUE; |
260 | } else { | 259 | } else { |
261 | editCommandListMenu->insertItem( tr( "Hide command list" )); | 260 | editCommandListMenu->insertItem( tr( "Hide command list" )); |
262 | listHidden=FALSE; | 261 | listHidden=FALSE; |
263 | } | 262 | } |
264 | 263 | ||
265 | cfg.setGroup("Tabs"); | 264 | cfg.setGroup("Tabs"); |
266 | tmp=cfg.readEntry("Position","Bottom"); | 265 | tmp=cfg.readEntry("Position","Bottom"); |
267 | if(tmp=="Top") { | 266 | if(tmp=="Top") { |
268 | tab->setTabPosition(QTabWidget::Top); | 267 | tab->setTabPosition(QTabWidget::Top); |
269 | configMenu->insertItem( tr( "Tabs on Bottom" ) ); | 268 | configMenu->insertItem( tr( "Tabs on Bottom" ) ); |
270 | } else { | 269 | } else { |
271 | tab->setTabPosition(QTabWidget::Bottom); | 270 | tab->setTabPosition(QTabWidget::Bottom); |
272 | configMenu->insertItem("Tabs on Top"); | 271 | configMenu->insertItem("Tabs on Top"); |
273 | } | 272 | } |
274 | configMenu->insertSeparator(2); | 273 | configMenu->insertSeparator(2); |
275 | 274 | ||
276 | colorMenu->insertItem(tr( "Green on Black")); | 275 | colorMenu->insertItem(tr( "Green on Black")); |
277 | colorMenu->insertItem(tr( "Black on White")); | 276 | colorMenu->insertItem(tr( "Black on White")); |
278 | colorMenu->insertItem(tr( "White on Black")); | 277 | colorMenu->insertItem(tr( "White on Black")); |
279 | colorMenu->insertItem(tr( "Black on Transparent")); | 278 | colorMenu->insertItem(tr( "Black on Transparent")); |
280 | colorMenu->insertItem(tr( "Black on Red")); | 279 | colorMenu->insertItem(tr( "Black on Red")); |
281 | colorMenu->insertItem(tr( "Red on Black")); | 280 | colorMenu->insertItem(tr( "Red on Black")); |
282 | colorMenu->insertItem(tr( "Green on Yellow")); | 281 | colorMenu->insertItem(tr( "Green on Yellow")); |
283 | colorMenu->insertItem(tr( "Blue on Magenta")); | 282 | colorMenu->insertItem(tr( "Blue on Magenta")); |
284 | colorMenu->insertItem(tr( "Magenta on Blue")); | 283 | colorMenu->insertItem(tr( "Magenta on Blue")); |
285 | colorMenu->insertItem(tr( "Cyan on White")); | 284 | colorMenu->insertItem(tr( "Cyan on White")); |
286 | colorMenu->insertItem(tr( "White on Cyan")); | 285 | colorMenu->insertItem(tr( "White on Cyan")); |
287 | colorMenu->insertItem(tr( "Blue on Black")); | 286 | colorMenu->insertItem(tr( "Blue on Black")); |
288 | colorMenu->insertItem(tr( "Amber on Black")); | 287 | colorMenu->insertItem(tr( "Amber on Black")); |
289 | configMenu->insertItem(tr( "Colors") ,colorMenu); | 288 | configMenu->insertItem(tr( "Colors") ,colorMenu); |
290 | 289 | ||
291 | connect( fontList, SIGNAL( activated(int) ), this, SLOT( fontChanged(int) )); | 290 | connect( fontList, SIGNAL( activated(int) ), this, SLOT( fontChanged(int) )); |
292 | connect( configMenu, SIGNAL( activated(int) ), this, SLOT( configMenuSelected(int) )); | 291 | connect( configMenu, SIGNAL( activated(int) ), this, SLOT( configMenuSelected(int) )); |
293 | connect( colorMenu, SIGNAL( activated(int) ), this, SLOT( colorMenuSelected(int) )); | 292 | connect( colorMenu, SIGNAL( activated(int) ), this, SLOT( colorMenuSelected(int) )); |
294 | connect( scrollMenu, SIGNAL(activated(int)),this,SLOT(scrollMenuSelected(int))); | 293 | connect( scrollMenu, SIGNAL(activated(int)),this,SLOT(scrollMenuSelected(int))); |
295 | connect(editCommandListMenu,SIGNAL(activated(int)),this,SLOT(editCommandListMenuSelected(int))); | 294 | connect(editCommandListMenu,SIGNAL(activated(int)),this,SLOT(editCommandListMenuSelected(int))); |
296 | menuBar->insertItem( tr("Font"), fontList ); | 295 | menuBar->insertItem( tr("Font"), fontList ); |
297 | menuBar->insertItem( tr("Options"), configMenu ); | 296 | menuBar->insertItem( tr("Options"), configMenu ); |
298 | 297 | ||
299 | QPEToolBar *toolbar = new QPEToolBar( this ); | 298 | QPEToolBar *toolbar = new QPEToolBar( this ); |
300 | 299 | ||
301 | QAction *a; | 300 | QAction *a; |
302 | 301 | ||
303 | // Button Commands | 302 | // Button Commands |
304 | a = new QAction( tr("New"), Resource::loadPixmap( "konsole" ), QString::null, 0, this, 0 ); | 303 | a = new QAction( tr("New"), Resource::loadPixmap( "konsole" ), QString::null, 0, this, 0 ); |
305 | connect( a, SIGNAL( activated() ), this, SLOT( newSession() ) ); a->addTo( toolbar ); | 304 | connect( a, SIGNAL( activated() ), this, SLOT( newSession() ) ); a->addTo( toolbar ); |
306 | a = new QAction( tr("Enter"), Resource::loadPixmap( "konsole/enter" ), QString::null, 0, this, 0 ); | 305 | a = new QAction( tr("Enter"), Resource::loadPixmap( "konsole/enter" ), QString::null, 0, this, 0 ); |
307 | connect( a, SIGNAL( activated() ), this, SLOT( hitEnter() ) ); a->addTo( toolbar ); | 306 | connect( a, SIGNAL( activated() ), this, SLOT( hitEnter() ) ); a->addTo( toolbar ); |
308 | a = new QAction( tr("Space"), Resource::loadPixmap( "konsole/space" ), QString::null, 0, this, 0 ); | 307 | a = new QAction( tr("Space"), Resource::loadPixmap( "konsole/space" ), QString::null, 0, this, 0 ); |
309 | connect( a, SIGNAL( activated() ), this, SLOT( hitSpace() ) ); a->addTo( toolbar ); | 308 | connect( a, SIGNAL( activated() ), this, SLOT( hitSpace() ) ); a->addTo( toolbar ); |
310 | a = new QAction( tr("Tab"), Resource::loadPixmap( "konsole/tab" ), QString::null, 0, this, 0 ); | 309 | a = new QAction( tr("Tab"), Resource::loadPixmap( "konsole/tab" ), QString::null, 0, this, 0 ); |
311 | connect( a, SIGNAL( activated() ), this, SLOT( hitTab() ) ); a->addTo( toolbar ); | 310 | connect( a, SIGNAL( activated() ), this, SLOT( hitTab() ) ); a->addTo( toolbar ); |
312 | a = new QAction( tr("Up"), Resource::loadPixmap( "konsole/up" ), QString::null, 0, this, 0 ); | 311 | a = new QAction( tr("Up"), Resource::loadPixmap( "konsole/up" ), QString::null, 0, this, 0 ); |
313 | connect( a, SIGNAL( activated() ), this, SLOT( hitUp() ) ); a->addTo( toolbar ); | 312 | connect( a, SIGNAL( activated() ), this, SLOT( hitUp() ) ); a->addTo( toolbar ); |
314 | a = new QAction( tr("Down"), Resource::loadPixmap( "konsole/down" ), QString::null, 0, this, 0 ); | 313 | a = new QAction( tr("Down"), Resource::loadPixmap( "konsole/down" ), QString::null, 0, this, 0 ); |
315 | connect( a, SIGNAL( activated() ), this, SLOT( hitDown() ) ); a->addTo( toolbar ); | 314 | connect( a, SIGNAL( activated() ), this, SLOT( hitDown() ) ); a->addTo( toolbar ); |
316 | a = new QAction( tr("Paste"), Resource::loadPixmap( "paste" ), QString::null, 0, this, 0 ); | 315 | a = new QAction( tr("Paste"), Resource::loadPixmap( "paste" ), QString::null, 0, this, 0 ); |
317 | connect( a, SIGNAL( activated() ), this, SLOT( hitPaste() ) ); a->addTo( toolbar ); | 316 | connect( a, SIGNAL( activated() ), this, SLOT( hitPaste() ) ); a->addTo( toolbar ); |
318 | /* | 317 | /* |
319 | a = new QAction( tr("Up"), Resource::loadPixmap( "up" ), QString::null, 0, this, 0 ); | 318 | a = new QAction( tr("Up"), Resource::loadPixmap( "up" ), QString::null, 0, this, 0 ); |
320 | connect( a, SIGNAL( activated() ), this, SLOT( hitUp() ) ); a->addTo( toolbar ); | 319 | connect( a, SIGNAL( activated() ), this, SLOT( hitUp() ) ); a->addTo( toolbar ); |
321 | a = new QAction( tr("Down"), Resource::loadPixmap( "down" ), QString::null, 0, this, 0 ); | 320 | a = new QAction( tr("Down"), Resource::loadPixmap( "down" ), QString::null, 0, this, 0 ); |
322 | connect( a, SIGNAL( activated() ), this, SLOT( hitDown() ) ); a->addTo( toolbar ); | 321 | connect( a, SIGNAL( activated() ), this, SLOT( hitDown() ) ); a->addTo( toolbar ); |
323 | */ | 322 | */ |
324 | 323 | ||
325 | secondToolBar = new QPEToolBar( this ); | 324 | secondToolBar = new QPEToolBar( this ); |
326 | secondToolBar->setHorizontalStretchable( TRUE ); | 325 | secondToolBar->setHorizontalStretchable( TRUE ); |
327 | 326 | ||
328 | commonCombo = new QComboBox( secondToolBar ); | 327 | commonCombo = new QComboBox( secondToolBar ); |
329 | commonCombo->setMaximumWidth(236); | 328 | commonCombo->setMaximumWidth(236); |
330 | 329 | ||
331 | editCommandListMenu->insertItem( tr( "Quick Edit" ) ); | 330 | editCommandListMenu->insertItem( tr( "Quick Edit" ) ); |
332 | if( listHidden) { | 331 | if( listHidden) { |
333 | secondToolBar->hide(); | 332 | secondToolBar->hide(); |
334 | editCommandListMenu->setItemEnabled(-22 ,FALSE); | 333 | editCommandListMenu->setItemEnabled(-22 ,FALSE); |
335 | } | 334 | } |
336 | editCommandListMenu->insertItem(tr( "Edit" ) ); | 335 | editCommandListMenu->insertItem(tr( "Edit" ) ); |
337 | 336 | ||
338 | cfg.setGroup("Commands"); | 337 | cfg.setGroup("Commands"); |
339 | commonCombo->setInsertionPolicy(QComboBox::AtCurrent); | 338 | commonCombo->setInsertionPolicy(QComboBox::AtCurrent); |
340 | 339 | ||
341 | initCommandList(); | 340 | initCommandList(); |
342 | // for (int i = 0; commonCmds[i] != NULL; i++) { | 341 | // for (int i = 0; commonCmds[i] != NULL; i++) { |
343 | // commonCombo->insertItem( commonCmds[i], i ); | 342 | // commonCombo->insertItem( commonCmds[i], i ); |
344 | // tmp = cfg.readEntry( QString::number(i),""); | 343 | // tmp = cfg.readEntry( QString::number(i),""); |
345 | // if(tmp != "") | 344 | // if(tmp != "") |
346 | // commonCombo->changeItem( tmp,i ); | 345 | // commonCombo->changeItem( tmp,i ); |
347 | // } | 346 | // } |
348 | 347 | ||
349 | connect( commonCombo, SIGNAL( activated(int) ), this, SLOT( enterCommand(int) )); | 348 | connect( commonCombo, SIGNAL( activated(int) ), this, SLOT( enterCommand(int) )); |
350 | 349 | ||
351 | scrollMenu->insertItem(tr( "None" )); | 350 | scrollMenu->insertItem(tr( "None" )); |
352 | scrollMenu->insertItem(tr( "Left" )); | 351 | scrollMenu->insertItem(tr( "Left" )); |
353 | scrollMenu->insertItem(tr( "Right" )); | 352 | scrollMenu->insertItem(tr( "Right" )); |
354 | configMenu->insertItem(tr( "ScrollBar" ),scrollMenu); | 353 | configMenu->insertItem(tr( "ScrollBar" ),scrollMenu); |
355 | 354 | ||
356 | // create applications ///////////////////////////////////////////////////// | 355 | // create applications ///////////////////////////////////////////////////// |
357 | setCentralWidget(tab); | 356 | setCentralWidget(tab); |
358 | 357 | ||
359 | // load keymaps //////////////////////////////////////////////////////////// | 358 | // load keymaps //////////////////////////////////////////////////////////// |
360 | KeyTrans::loadAll(); | 359 | KeyTrans::loadAll(); |
361 | for (int i = 0; i < KeyTrans::count(); i++) | 360 | for (int i = 0; i < KeyTrans::count(); i++) |
362 | { KeyTrans* s = KeyTrans::find(i); | 361 | { KeyTrans* s = KeyTrans::find(i); |
363 | assert( s ); | 362 | assert( s ); |
364 | } | 363 | } |