author | llornkcor <llornkcor> | 2005-02-06 02:25:25 (UTC) |
---|---|---|
committer | llornkcor <llornkcor> | 2005-02-06 02:25:25 (UTC) |
commit | c3892e6c1a4ca15383a7da48f6d72b1d7d26f43d (patch) (unidiff) | |
tree | f4d401a3479c04923e11da27ef976bd21df4d12c | |
parent | 57d3426a26a2695be0d5358c99be3db9a90da806 (diff) | |
download | opie-c3892e6c1a4ca15383a7da48f6d72b1d7d26f43d.zip opie-c3892e6c1a4ca15383a7da48f6d72b1d7d26f43d.tar.gz opie-c3892e6c1a4ca15383a7da48f6d72b1d7d26f43d.tar.bz2 |
adding shell history into command combo off by default
-rw-r--r-- | core/apps/embeddedkonsole/konsole.cpp | 43 |
1 files changed, 14 insertions, 29 deletions
diff --git a/core/apps/embeddedkonsole/konsole.cpp b/core/apps/embeddedkonsole/konsole.cpp index 5cfd644..8b4202d 100644 --- a/core/apps/embeddedkonsole/konsole.cpp +++ b/core/apps/embeddedkonsole/konsole.cpp | |||
@@ -290,4 +290,3 @@ void Konsole::initCommandList() | |||
290 | 290 | ||
291 | if (cfg.readEntry("ShellHistory","TRUE") == "TRUE") | 291 | if (cfg.readEntry("ShellHistory","TRUE") == "FALSE") { |
292 | { | ||
293 | QString histfilename = QString(getenv("HOME")) + "/.bash_history"; | 292 | QString histfilename = QString(getenv("HOME")) + "/.bash_history"; |
@@ -297,4 +296,3 @@ void Konsole::initCommandList() | |||
297 | // QFile histfile(QString(getenv("HOME")) + "/.bash_history"); | 296 | // QFile histfile(QString(getenv("HOME")) + "/.bash_history"); |
298 | if (histfile.open( IO_ReadOnly )) | 297 | if (histfile.open( IO_ReadOnly )) { |
299 | { | ||
300 | QString line; | 298 | QString line; |
@@ -304,6 +302,4 @@ void Konsole::initCommandList() | |||
304 | int lineno = 0; | 302 | int lineno = 0; |
305 | while(!histfile.atEnd()) | 303 | while(!histfile.atEnd()) { |
306 | { | 304 | if (histfile.readLine(line, 200) < 0) { |
307 | if (histfile.readLine(line, 200) < 0) | ||
308 | { | ||
309 | break; | 305 | break; |
@@ -313,6 +309,4 @@ void Konsole::initCommandList() | |||
313 | 309 | ||
314 | for(i=0; i<items.count(); i++) | 310 | for(i=0; i<items.count(); i++) { |
315 | { | 311 | if (line == items.at(i)->line) { |
316 | if (line == items.at(i)->line) | ||
317 | { | ||
318 | // weight recent commands & repeated commands more | 312 | // weight recent commands & repeated commands more |
@@ -323,4 +317,3 @@ void Konsole::initCommandList() | |||
323 | } | 317 | } |
324 | if (i >= items.count()) | 318 | if (i >= items.count()) { |
325 | { | ||
326 | items.append(new HistoryItem(lineno, line)); | 319 | items.append(new HistoryItem(lineno, line)); |
@@ -330,11 +323,8 @@ void Konsole::initCommandList() | |||
330 | int n = items.count(); | 323 | int n = items.count(); |
331 | if (n > 40) | 324 | if (n > 40) { |
332 | { | ||
333 | n = 40; | 325 | n = 40; |
334 | } | 326 | } |
335 | for(int i=0; i<n; i++) | 327 | for(int i=0; i<n; i++) { |
336 | { | ||
337 | // should insert start of command, but keep whole thing | 328 | // should insert start of command, but keep whole thing |
338 | if (items.at(items.count()-i-1)->line.length() < 30) | 329 | if (items.at(items.count()-i-1)->line.length() < 30) { |
339 | { | ||
340 | commonCombo->insertItem(items.at(items.count()-i-1)->line); | 330 | commonCombo->insertItem(items.at(items.count()-i-1)->line); |
@@ -345,13 +335,8 @@ void Konsole::initCommandList() | |||
345 | } | 335 | } |
346 | if (cfg.readEntry("Commands Set","FALSE") == "FALSE") | 336 | if (cfg.readEntry("Commands Set","FALSE") == "FALSE") { |
347 | { | 337 | for (int i = 0; commonCmds[i] != NULL; i++) { |
348 | for (int i = 0; commonCmds[i] != NULL; i++) | ||
349 | { | ||
350 | commonCombo->insertItem(commonCmds[i]); | 338 | commonCombo->insertItem(commonCmds[i]); |
351 | } | 339 | } |
352 | } | 340 | } else { |
353 | else | 341 | for (int i = 0; i < 100; i++) { |
354 | { | ||
355 | for (int i = 0; i < 100; i++) | ||
356 | { | ||
357 | if (!(cfg.readEntry( QString::number(i),"")).isEmpty()) | 342 | if (!(cfg.readEntry( QString::number(i),"")).isEmpty()) |