summaryrefslogtreecommitdiffabout
Unidiff
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--bin/kdepim/korganizer/germantranslation.txt6
-rw-r--r--korganizer/kotodoview.cpp16
-rw-r--r--libkcal/todo.cpp13
-rw-r--r--libkcal/todo.h3
-rw-r--r--qtcompat/qinputdialog.cpp2
5 files changed, 33 insertions, 7 deletions
diff --git a/bin/kdepim/korganizer/germantranslation.txt b/bin/kdepim/korganizer/germantranslation.txt
index bba9f87..2cb0132 100644
--- a/bin/kdepim/korganizer/germantranslation.txt
+++ b/bin/kdepim/korganizer/germantranslation.txt
@@ -1291,83 +1291,85 @@
1291{ "Export selected","Exportiere Selektierte" }, 1291{ "Export selected","Exportiere Selektierte" },
1292{ "As iCal (ics) file...","Als iCal (ics) Datei..." }, 1292{ "As iCal (ics) file...","Als iCal (ics) Datei..." },
1293{ "As vCal (vcs) file...","Als vCal (vcs) Datei..." }, 1293{ "As vCal (vcs) file...","Als vCal (vcs) Datei..." },
1294{ "Journal/Details...","Journale/Details..." }, 1294{ "Journal/Details...","Journale/Details..." },
1295{ "Agenda View","Agenda Ansicht" }, 1295{ "Agenda View","Agenda Ansicht" },
1296{ "Show current time","Zeige aktuelle Zeit" }, 1296{ "Show current time","Zeige aktuelle Zeit" },
1297{ "Edit new item","Bearbeite neuen Eintrag" }, 1297{ "Edit new item","Bearbeite neuen Eintrag" },
1298{ "Please select at least one\nof the types to search for:\n\nEvents\nTodos\nJournals","Bitte wählen Sie mindestens\neinen dieser Typen\num darin zu suchen:\n\nTermine\nTodos\nJournale" }, 1298{ "Please select at least one\nof the types to search for:\n\nEvents\nTodos\nJournals","Bitte wählen Sie mindestens\neinen dieser Typen\num darin zu suchen:\n\nTermine\nTodos\nJournale" },
1299{ "There is no next alarm.","Es gibt keinen nächsten Alarm." }, 1299{ "There is no next alarm.","Es gibt keinen nächsten Alarm." },
1300{ "%1 %2 - %3 (next event/todo with alarm)","%1 %2 - %3 (nächster Termin/Todo mit Alarm)" }, 1300{ "%1 %2 - %3 (next event/todo with alarm)","%1 %2 - %3 (nächster Termin/Todo mit Alarm)" },
1301{ "The next alarm is in:\n","Der nächste Alarm ist in:\n" }, 1301{ "The next alarm is in:\n","Der nächste Alarm ist in:\n" },
1302{ "%1 days\n","%1 Tagen\n" }, 1302{ "%1 days\n","%1 Tagen\n" },
1303{ "1 day\n","1 Tag\n" }, 1303{ "1 day\n","1 Tag\n" },
1304{ "%1 hours\n","%1 Stunden\n" }, 1304{ "%1 hours\n","%1 Stunden\n" },
1305{ "1 hour\n","1 Stunde\n" }, 1305{ "1 hour\n","1 Stunde\n" },
1306{ "%1 minutes\n","%1 Minuten\n" }, 1306{ "%1 minutes\n","%1 Minuten\n" },
1307{ "1 minute\n","1 Minute\n" }, 1307{ "1 minute\n","1 Minute\n" },
1308{ "Only one toolbar","Nur eine Toolbar" }, 1308{ "Only one toolbar","Nur eine Toolbar" },
1309{ "Print","Drucke" }, 1309{ "Print","Drucke" },
1310{ "Print selected event / todo...","Drucke ausgewählten Termin / Todo..." }, 1310{ "Print selected event / todo...","Drucke ausgewählten Termin / Todo..." },
1311{ "There is nothing selected!","Es ist nichts ausgewählt!" }, 1311{ "There is nothing selected!","Es ist nichts ausgewählt!" },
1312{ "\n\nDo you really want to print this item?","\n\nMöchten Sie wirklich diesen Eintrag ausdrucken? " }, 1312{ "\n\nDo you really want to print this item?","\n\nMöchten Sie wirklich diesen Eintrag ausdrucken? " },
1313{ "KO/Pi Print Confirmation","KO/Pi Druckbestätigung" }, 1313{ "KO/Pi Print Confirmation","KO/Pi Druckbestätigung" },
1314{ "This prints the view as you see it.\n(With the complete content, of course.)\nYou may change the print layout by resizing the view.\nPrint unscaled may print several pages\ndepending on the amount of data.\nPrint scaled down will print all on one page.\nPrint scaled up/down will print all on one page,\nbut will scale up the text to page boundaries,\nif the text is smaller than the page.\nYou can select page geometry setup in the next dialog.\n","Dies druckt die Ansicht wie man sie sieht.\n(Mit dem kompletten Inhalt natürlich.)\nMan kann das Layout ändern durch ändern der Fenstergröße.\nDrucke unskaliert druckt ggf. mehrere Seiten\nabhängig von der Menge der Daten.\nDrucke runterskaliert um auf eine Seite zu passen\ndruckt alles auf eine Seite.\nDrucke hoch/runterskaliert um genau auf eine Seite zu passen\nvergrößert den Text gegebenenfalls.\nDas Seitenlayout kann im nächsten Dialog gewählt werden.\n" }, 1314{ "This prints the view as you see it.\n(With the complete content, of course.)\nYou may change the print layout by resizing the view.\nPrint unscaled may print several pages\ndepending on the amount of data.\nPrint scaled down will print all on one page.\nPrint scaled up/down will print all on one page,\nbut will scale up the text to page boundaries,\nif the text is smaller than the page.\nYou can select page geometry setup in the next dialog.\n","Dies druckt die Ansicht wie man sie sieht.\n(Mit dem kompletten Inhalt natürlich.)\nMan kann das Layout ändern durch ändern der Fenstergröße.\nDrucke unskaliert druckt ggf. mehrere Seiten\nabhängig von der Menge der Daten.\nDrucke runterskaliert um auf eine Seite zu passen\ndruckt alles auf eine Seite.\nDrucke hoch/runterskaliert um genau auf eine Seite zu passen\nvergrößert den Text gegebenenfalls.\nDas Seitenlayout kann im nächsten Dialog gewählt werden.\n" },
1315{ "KO/Pi Printout","KO/Pi Ausdruck" }, 1315{ "KO/Pi Printout","KO/Pi Ausdruck" },
1316{ "Print unscaled","Drucke unskaliert" }, 1316{ "Print unscaled","Drucke unskaliert" },
1317{ "Print scaled down to fit one page","Drucke runterskaliert um auf eine Seite zu passen." }, 1317{ "Print scaled down to fit one page","Drucke runterskaliert um auf eine Seite zu passen." },
1318{ "Print scaled up/down to fit one page","Drucke hoch/runterskaliert um genau auf eine Seite zu passen." }, 1318{ "Print scaled up/down to fit one page","Drucke hoch/runterskaliert um genau auf eine Seite zu passen." },
1319{ "Printout Mode","Druck Modus" }, 1319{ "Printout Mode","Druck Modus" },
1320{ "Filter menu icon","Filtermenu Icon" }, 1320{ "Filter menu icon","Filtermenu Icon" },
1321{ "<p><b>A+(shift or ctrl)</b>: Show occurence of next alarm</p>\n","<p><b>A+(shift oder ctrl)</b>: Zeige Zeit bis zum nächsten Alarm</p>\n" }, 1321{ "<p><b>A+(shift or ctrl)</b>: Show occurence of next alarm</p>\n","<p><b>A+(shift oder ctrl)</b>: Zeige Zeit bis zum nächsten Alarm</p>\n" },
1322{ "<p><b>N</b>: Switch to next view which has a toolbar icon</p>\n","<p><b>N</b>: Wechsle zur nächsten Ansicht, die ein Icon in der Toolbar hat</p>\n" }, 1322{ "<p><b>N</b>: Switch to next view which has a toolbar icon</p>\n","<p><b>N</b>: Wechsle zur nächsten Ansicht, die ein Icon in der Toolbar hat</p>\n" },
1323{ "%1d","%1t" }, 1323{ "%1d","%1t" },
1324{ "%1h","%1std" }, 1324{ "%1h","%1std" },
1325{ "%1min","%1min" }, 1325{ "%1min","%1min" },
1326{ "( %1 before )","( %1 vorher )" }, 1326{ "( %1 before )","( %1 vorher )" },
1327{ "The next alarm is in\nless than one minute!","Der nächste Alarm kommt in\nweniger als einer Minute!" }, 1327{ "The next alarm is in\nless than one minute!","Der nächste Alarm kommt in\nweniger als einer Minute!" },
1328{ "\nThe internal alarm notification is disabled!\n","\nDie interne Alarmbenachrichtigung ist ausgeschaltet!\n" }, 1328{ "\nThe internal alarm notification is disabled!\n","\nDie interne Alarmbenachrichtigung ist ausgeschaltet!\n" },
1329{ "Enable it in the settings menu, TAB alarm.","Schalten Sie sie an im Menu Einstellungen, TAB Alarm." }, 1329{ "Enable it in the settings menu, TAB alarm.","Schalten Sie sie an im Menu Einstellungen, TAB Alarm." },
1330{ "Show Sync Events","Zeige Sync-Ereignisse" }, 1330{ "Show Sync Events","Zeige Sync-Ereignisse" },
1331{ "Use short date in WN+Event view","Zeige Kurzdatum in WN+Terminanzeige" }, 1331{ "Use short date in WN+Event view","Zeige Kurzdatum in WN+Terminanzeige" },
1332{ "Number of max.displayed todo prios:","Anzahl max.angezeigter Todo-Prios:" }, 1332{ "Number of max.displayed todo prios:","Anzahl max.angezeigter Todo-Prios:" },
1333{ " on "," am " }, 1333{ " on "," am " },
1334{ "On: ","Am: " }, 1334{ "On: ","Am: " },
1335{ "<i>The recurrence is computed from the start datetime!</i>","<i>Die Wiederholung wird vom Startwert aus berechnet!</i>" }, 1335{ "<i>The recurrence is computed from the start datetime!</i>","<i>Die Wiederholung wird vom Startwert aus berechnet!</i>" },
1336{ "Start/Stop todo...","Starte/Stoppe Todo..." }, 1336{ "Start/Stop todo...","Starte/Stoppe Todo..." },
1337{ "Color for running todos:","Farbe für laufende Todos:" }, 1337{ "Color for running todos:","Farbe für laufende Todos:" },
1338{ "The todo\n%1\nis started.\nDo you want to set\nthe state to stopped?","Das Todo\n%1\nist gestartet.\nWollen Sie es\nauf gestoppt setzen?" }, 1338{ "The todo\n%1\nis started.\nDo you want to set\nthe state to stopped?","Das Todo\n%1\nist gestartet.\nWollen Sie es\nauf gestoppt setzen?" },
1339{ "Todo is started","Todo is gestarted" }, 1339{ "Todo is started","Todo ist gestartet" },
1340{ "Stop todo","Stoppe Todo" }, 1340{ "Stop todo","Stoppe Todo" },
1341{ "Todo is stopped","Todo ist gestoppt" }, 1341{ "Todo is stopped","Todo ist gestoppt" },
1342{ "Start todo","Starte Todo" }, 1342{ "Start todo","Starte Todo" },
1343{ "The todo\n%1\nis stopped.\nDo you want to set\nthe state to started?","Das Todo\n%1\nist gestoppt.\nWollen Sie es auf\ngestartet setzen?" }, 1343{ "The todo\n%1\nis stopped.\nDo you want to set\nthe state to started?","Das Todo\n%1\nist gestoppt.\nWollen Sie es auf\ngestartet setzen?" },
1344{ "The todo\n%1\nwill be cloned!\nIt has subtodos!\nDo you want to clone\nall subtodos as well?","Das Todo\n%1\nwird geklont!\nEs hat Untertodos!\nMöchten Sie alle\nUntertodos auch klonen?" }, 1344{ "The todo\n%1\nwill be cloned!\nIt has subtodos!\nDo you want to clone\nall subtodos as well?","Das Todo\n%1\nwird geklont!\nEs hat Untertodos!\nMöchten Sie alle\nUntertodos auch klonen?" },
1345{ "Todo has subtodos","Todo hat Untertodos" }, 1345{ "Todo has subtodos","Todo hat Untertodos" },
1346{ "Block popup until mouse button release","Sperre Popup bis Mausknopf losgelassen" }, 1346{ "Block popup until mouse button release","Sperre Popup bis Mausknopf losgelassen" },
1347{ "Colors","Farben" }, 1347{ "Colors","Farben" },
1348{ "Click on new parent item","Klicke auf neues Übertodo" }, 1348{ "Click on new parent item","Klicke auf neues Übertodo" },
1349{ "Reparenting aborted!","Übertodo setzen abgebrochen" }, 1349{ "Reparenting aborted!","Übertodo setzen abgebrochen" },
1350{ "Cannot move Todo to itself\nor a child of itself","Kann nicht Todo auf\nsich selbst oder\nein Untertodo verschieben" }, 1350{ "Cannot move Todo to itself\nor a child of itself","Kann nicht Todo auf\nsich selbst oder\nein Untertodo verschieben" },
1351{ "Recursive reparenting not possible!","Rekursives Verschieben nicht möglich" }, 1351{ "Recursive reparenting not possible!","Rekursives Verschieben nicht möglich" },
1352{ "Delete all completed todos?\n(Completed recurring todos\nwill not be deleted!)","Entferne alle erledigten Todos?\n(Erledigte wiederholende Todos\nwerden nicht gelöscht!)" }, 1352{ "Delete all completed todos?\n(Completed recurring todos\nwill not be deleted!)","Entferne alle erledigten Todos?\n(Erledigte wiederholende Todos\nwerden nicht gelöscht!)" },
1353{ "Alternating background of list views","Abwechselnder Hintergrund für Listen" }, 1353{ "Alternating background of list views","Abwechselnder Hintergrund für Listen" },
1354{ "times","Zeiten" }, 1354{ "times","Zeiten" },
1355{ "The todo\n%1\nhas subtodos!\nDo you want to set\nthe categories for\nall subtodos as well?","Das Todo\n%1\nhat Untertodos!\nMöchten Sie die Kategorien\nauch für alle Untertodos setzen?" }, 1355{ "The todo\n%1\nhas subtodos!\nDo you want to set\nthe categories for\nall subtodos as well?","Das Todo\n%1\nhat Untertodos!\nMöchten Sie die Kategorien\nauch für alle Untertodos setzen?" },
1356{ "Backup enabled","Backup angeschaltet" }, 1356{ "Backup enabled","Backup angeschaltet" },
1357{ "Use standard backup dir","Standard Backupverzeichnis" }, 1357{ "Use standard backup dir","Standard Backupverzeichnis" },
1358{ "Number of Backups:","Anzahl der Backups" }, 1358{ "Number of Backups:","Anzahl der Backups" },
1359{ "Make backup every ","Mache ein Backup alle " }, 1359{ "Make backup every ","Mache ein Backup alle " },
1360{ " days"," Tage" }, 1360{ " days"," Tage" },
1361{ "Creating backup ... please wait ...","Erzeuge Backup ... bitte warten ..." }, 1361{ "Creating backup ... please wait ...","Erzeuge Backup ... bitte warten ..." },
1362{ "Backup Failed!","Backup Problem!" }, 1362{ "Backup Failed!","Backup Problem!" },
1363{ "Try again now","Versuche jetzt nochmal" }, 1363{ "Try again now","Versuche jetzt nochmal" },
1364{ "Try again later","Versuche später nochmal" }, 1364{ "Try again later","Versuche später nochmal" },
1365{ "Try again tomorrow","Versuche morgen nochmal" }, 1365{ "Try again tomorrow","Versuche morgen nochmal" },
1366{ "Disable backup","Schalte Backup ab" }, 1366{ "Disable backup","Schalte Backup ab" },
1367{ "<b>Backup directory does not exist: </b>","<b>Backup Verzeichnis existiert nicht: </b>" }, 1367{ "<b>Backup directory does not exist: </b>","<b>Backup Verzeichnis existiert nicht: </b>" },
1368{ "<b>The backup copy command failed!</b>","<b>Das Backup Kopierkommando is fehlgeschlagen!</b>" }, 1368{ "<b>The backup copy command failed!</b>","<b>Das Backup Kopierkommando is fehlgeschlagen!</b>" },
1369{ "Choose action","Wähle Aktion" }, 1369{ "Choose action","Wähle Aktion" },
1370{ "Comment for todo:","Kommentar zum Todo:" },
1371{ "Stop+note","Stop+Notiz" },
1370{ "","" }, 1372{ "","" },
1371{ "","" }, 1373{ "","" },
1372{ "","" }, 1374{ "","" },
1373{ "","" }, 1375{ "","" }, \ No newline at end of file
diff --git a/korganizer/kotodoview.cpp b/korganizer/kotodoview.cpp
index e95039d..8fe9999 100644
--- a/korganizer/kotodoview.cpp
+++ b/korganizer/kotodoview.cpp
@@ -1,76 +1,78 @@
1/* 1/*
2 This file is part of KOrganizer. 2 This file is part of KOrganizer.
3 Copyright (c) 2000,2001 Cornelius Schumacher <schumacher@kde.org> 3 Copyright (c) 2000,2001 Cornelius Schumacher <schumacher@kde.org>
4 4
5 This program is free software; you can redistribute it and/or modify 5 This program is free software; you can redistribute it and/or modify
6 it under the terms of the GNU General Public License as published by 6 it under the terms of the GNU General Public License as published by
7 the Free Software Foundation; either version 2 of the License, or 7 the Free Software Foundation; either version 2 of the License, or
8 (at your option) any later version. 8 (at your option) any later version.
9 9
10 This program is distributed in the hope that it will be useful, 10 This program is distributed in the hope that it will be useful,
11 but WITHOUT ANY WARRANTY; without even the implied warranty of 11 but WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 GNU General Public License for more details. 13 GNU General Public License for more details.
14 14
15 You should have received a copy of the GNU General Public License 15 You should have received a copy of the GNU General Public License
16 along with this program; if not, write to the Free Software 16 along with this program; if not, write to the Free Software
17 Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. 17 Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
18 18
19 As a special exception, permission is given to link this program 19 As a special exception, permission is given to link this program
20 with any edition of Qt, and distribute the resulting executable, 20 with any edition of Qt, and distribute the resulting executable,
21 without including the source code for Qt in the source distribution. 21 without including the source code for Qt in the source distribution.
22*/ 22*/
23 23
24#include <qlayout.h> 24#include <qlayout.h>
25#include <qheader.h> 25#include <qheader.h>
26#include <qcursor.h> 26#include <qcursor.h>
27#include <qwhatsthis.h> 27#include <qwhatsthis.h>
28 28
29#include <qinputdialog.h>
30
29#include <qvbox.h> 31#include <qvbox.h>
30#include <kdebug.h> 32#include <kdebug.h>
31#include "koprefs.h" 33#include "koprefs.h"
32#include <klocale.h> 34#include <klocale.h>
33#include <kglobal.h> 35#include <kglobal.h>
34#include <kiconloader.h> 36#include <kiconloader.h>
35#include <kmessagebox.h> 37#include <kmessagebox.h>
36 38
37#include <libkcal/icaldrag.h> 39#include <libkcal/icaldrag.h>
38#include <libkcal/vcaldrag.h> 40#include <libkcal/vcaldrag.h>
39#include <libkcal/calfilter.h> 41#include <libkcal/calfilter.h>
40#include <libkcal/dndfactory.h> 42#include <libkcal/dndfactory.h>
41#include <libkcal/calendarresources.h> 43#include <libkcal/calendarresources.h>
42#include <libkcal/resourcecalendar.h> 44#include <libkcal/resourcecalendar.h>
43#include <kresources/resourceselectdialog.h> 45#include <kresources/resourceselectdialog.h>
44#include <libkcal/kincidenceformatter.h> 46#include <libkcal/kincidenceformatter.h>
45#ifndef DESKTOP_VERSION 47#ifndef DESKTOP_VERSION
46#include <qpe/qpeapplication.h> 48#include <qpe/qpeapplication.h>
47#else 49#else
48#include <qapplication.h> 50#include <qapplication.h>
49#endif 51#endif
50#ifndef KORG_NOPRINTER 52#ifndef KORG_NOPRINTER
51#include "calprinter.h" 53#include "calprinter.h"
52#endif 54#endif
53#include "docprefs.h" 55#include "docprefs.h"
54 56
55#include "kotodoview.h" 57#include "kotodoview.h"
56using namespace KOrg; 58using namespace KOrg;
57 59
58 60
59class KOTodoViewWhatsThis :public QWhatsThis 61class KOTodoViewWhatsThis :public QWhatsThis
60{ 62{
61public: 63public:
62 KOTodoViewWhatsThis( QWidget *wid, KOTodoView* view ) : QWhatsThis( wid ), _wid(wid),_view (view) { }; 64 KOTodoViewWhatsThis( QWidget *wid, KOTodoView* view ) : QWhatsThis( wid ), _wid(wid),_view (view) { };
63 65
64protected: 66protected:
65 virtual QString text( const QPoint& p) 67 virtual QString text( const QPoint& p)
66 { 68 {
67 return _view->getWhatsThisText(p) ; 69 return _view->getWhatsThisText(p) ;
68 } 70 }
69private: 71private:
70 QWidget* _wid; 72 QWidget* _wid;
71 KOTodoView * _view; 73 KOTodoView * _view;
72}; 74};
73 75
74KOTodoListView::KOTodoListView(Calendar *calendar,QWidget *parent, 76KOTodoListView::KOTodoListView(Calendar *calendar,QWidget *parent,
75 const char *name) : 77 const char *name) :
76 KListView(parent,name) 78 KListView(parent,name)
@@ -1081,100 +1083,110 @@ void KOTodoView::changedCategories(int index)
1081 if ( !colcat.isEmpty() ) { 1083 if ( !colcat.isEmpty() ) {
1082 if ( categories.find ( colcat ) != categories.end () ) { 1084 if ( categories.find ( colcat ) != categories.end () ) {
1083 categories.remove( colcat ); 1085 categories.remove( colcat );
1084 categories.prepend( colcat ); 1086 categories.prepend( colcat );
1085 } 1087 }
1086 } 1088 }
1087 mActiveItem->todo()->setCategories (categories); 1089 mActiveItem->todo()->setCategories (categories);
1088 mActiveItem->construct(); 1090 mActiveItem->construct();
1089 mActiveItem->todo()->setRevision( mActiveItem->todo()->revision()+1 ); 1091 mActiveItem->todo()->setRevision( mActiveItem->todo()->revision()+1 );
1090 todoModified (mActiveItem->todo (), KOGlobals::CATEGORY_MODIFIED); 1092 todoModified (mActiveItem->todo (), KOGlobals::CATEGORY_MODIFIED);
1091 } 1093 }
1092} 1094}
1093void KOTodoView::itemDoubleClicked(QListViewItem *item) 1095void KOTodoView::itemDoubleClicked(QListViewItem *item)
1094{ 1096{
1095 if ( pendingSubtodo != 0 ) { 1097 if ( pendingSubtodo != 0 ) {
1096 topLevelWidget()->setCaption(i18n("Reparenting aborted!")); 1098 topLevelWidget()->setCaption(i18n("Reparenting aborted!"));
1097 } 1099 }
1098 pendingSubtodo = 0; 1100 pendingSubtodo = 0;
1099 //int row = mTodoListView->header()->sectionAt ( mTodoListView->header()->mapFromGlobal( QCursor::pos()).x() ); 1101 //int row = mTodoListView->header()->sectionAt ( mTodoListView->header()->mapFromGlobal( QCursor::pos()).x() );
1100 int row = mTodoListView->header()->sectionAt ( mTodoListView->viewportToContents(mTodoListView->viewport()->mapFromGlobal( QCursor::pos())) .x() ); 1102 int row = mTodoListView->header()->sectionAt ( mTodoListView->viewportToContents(mTodoListView->viewport()->mapFromGlobal( QCursor::pos())) .x() );
1101 //qDebug("ROW %d ", row); 1103 //qDebug("ROW %d ", row);
1102 if (!item) { 1104 if (!item) {
1103 newTodo(); 1105 newTodo();
1104 return; 1106 return;
1105 } else { 1107 } else {
1106 if ( row == 2 || row == 1 ) { 1108 if ( row == 2 || row == 1 ) {
1107 mActiveItem = (KOTodoViewItem *) item; 1109 mActiveItem = (KOTodoViewItem *) item;
1108 newSubTodo(); 1110 newSubTodo();
1109 return; 1111 return;
1110 } 1112 }
1111 if ( row == 5 || row == 6 ) { 1113 if ( row == 5 || row == 6 ) {
1112 mActiveItem = (KOTodoViewItem *) item; 1114 mActiveItem = (KOTodoViewItem *) item;
1113 toggleRunningItem(); 1115 toggleRunningItem();
1114 return; 1116 return;
1115 } 1117 }
1116 } 1118 }
1117 if ( KOPrefs::instance()->mEditOnDoubleClick ) 1119 if ( KOPrefs::instance()->mEditOnDoubleClick )
1118 editItem( item ); 1120 editItem( item );
1119 else 1121 else
1120 showItem( item , QPoint(), 0 ); 1122 showItem( item , QPoint(), 0 );
1121} 1123}
1122void KOTodoView::toggleRunningItem() 1124void KOTodoView::toggleRunningItem()
1123{ 1125{
1124 // qDebug("KOTodoView::toggleRunning() "); 1126 // qDebug("KOTodoView::toggleRunning() ");
1125 if ( ! mActiveItem ) 1127 if ( ! mActiveItem )
1126 return; 1128 return;
1127 Todo * t = mActiveItem->todo(); 1129 Todo * t = mActiveItem->todo();
1128 if ( t->isRunning() ) { 1130 if ( t->isRunning() ) {
1131#if 0
1129 int result = KMessageBox::warningContinueCancel(this, 1132 int result = KMessageBox::warningContinueCancel(this,
1130 i18n("The todo\n%1\nis started.\nDo you want to set\nthe state to stopped?").arg(mActiveItem->text(0).left( 25 ) ),i18n("Todo is started"),i18n("Stop todo"),i18n("Cancel"), true); 1133 i18n("The todo\n%1\nis started.\nDo you want to set\nthe state to stopped?").arg(mActiveItem->text(0).left( 25 ) ),i18n("Todo is started"),i18n("Stop todo"),i18n("Cancel"), true);
1131 if (result != KMessageBox::Continue) return; 1134#endif
1132 t->setRunning( false ); 1135
1136 int result = KMessageBox::warningYesNoCancel(this,
1137 i18n("The todo\n%1\nis started.\nDo you want to set\nthe state to stopped?").arg(mActiveItem->text(0).left( 25 ) ),i18n("Todo is started"),i18n("Stop"),i18n("Stop+note"));
1138 if (result == KMessageBox::Cancel) return;
1139 if ( result == KMessageBox::No ) {
1140 QString comment = QInputDialog::getText(mActiveItem->text(0).left( 25 ),i18n("Comment for todo:") );
1141 t->setRunningFalse( comment );
1142 } else {
1143 t->setRunning( false );
1144 }
1133 mActiveItem->construct(); 1145 mActiveItem->construct();
1134 } else { 1146 } else {
1135 int result = KMessageBox::warningContinueCancel(this, 1147 int result = KMessageBox::warningContinueCancel(this,
1136 i18n("The todo\n%1\nis stopped.\nDo you want to set\nthe state to started?").arg(mActiveItem->text(0).left( 25 ) ),i18n("Todo is stopped"),i18n("Start todo"),i18n("Cancel"), true); 1148 i18n("The todo\n%1\nis stopped.\nDo you want to set\nthe state to started?").arg(mActiveItem->text(0).left( 25 ) ),i18n("Todo is stopped"),i18n("Start todo"),i18n("Cancel"), true);
1137 if (result != KMessageBox::Continue) return; 1149 if (result != KMessageBox::Continue) return;
1138 t->setRunning( true ); 1150 t->setRunning( true );
1139 mActiveItem->construct(); 1151 mActiveItem->construct();
1140 } 1152 }
1141} 1153}
1142 1154
1143void KOTodoView::itemClicked(QListViewItem *item) 1155void KOTodoView::itemClicked(QListViewItem *item)
1144{ 1156{
1145 //qDebug("KOTodoView::itemClicked %d", item); 1157 //qDebug("KOTodoView::itemClicked %d", item);
1146 if (!item) { 1158 if (!item) {
1147 if ( pendingSubtodo != 0 ) { 1159 if ( pendingSubtodo != 0 ) {
1148 topLevelWidget()->setCaption(i18n("Reparenting aborted!")); 1160 topLevelWidget()->setCaption(i18n("Reparenting aborted!"));
1149 } 1161 }
1150 pendingSubtodo = 0; 1162 pendingSubtodo = 0;
1151 return; 1163 return;
1152 } 1164 }
1153 KOTodoViewItem *todoItem = (KOTodoViewItem *)item; 1165 KOTodoViewItem *todoItem = (KOTodoViewItem *)item;
1154 if ( pendingSubtodo != 0 ) { 1166 if ( pendingSubtodo != 0 ) {
1155 bool allowReparent = true; 1167 bool allowReparent = true;
1156 QListViewItem *par = item; 1168 QListViewItem *par = item;
1157 while ( par ) { 1169 while ( par ) {
1158 if ( par == pendingSubtodo ) { 1170 if ( par == pendingSubtodo ) {
1159 allowReparent = false; 1171 allowReparent = false;
1160 break; 1172 break;
1161 } 1173 }
1162 par = par->parent(); 1174 par = par->parent();
1163 } 1175 }
1164 if ( !allowReparent ) { 1176 if ( !allowReparent ) {
1165 topLevelWidget()->setCaption(i18n("Recursive reparenting not possible!")); 1177 topLevelWidget()->setCaption(i18n("Recursive reparenting not possible!"));
1166 pendingSubtodo = 0; 1178 pendingSubtodo = 0;
1167 } else { 1179 } else {
1168 Todo* newParent = todoItem->todo(); 1180 Todo* newParent = todoItem->todo();
1169 Todo* newSub = pendingSubtodo->todo(); 1181 Todo* newSub = pendingSubtodo->todo();
1170 pendingSubtodo = 0; 1182 pendingSubtodo = 0;
1171 emit reparentTodoSignal( newParent,newSub ); 1183 emit reparentTodoSignal( newParent,newSub );
1172 return; 1184 return;
1173 } 1185 }
1174 } 1186 }
1175 1187
1176} 1188}
1177 1189
1178void KOTodoView::setDocumentId( const QString &id ) 1190void KOTodoView::setDocumentId( const QString &id )
1179{ 1191{
1180 1192
diff --git a/libkcal/todo.cpp b/libkcal/todo.cpp
index 002d3f2..f7e38a7 100644
--- a/libkcal/todo.cpp
+++ b/libkcal/todo.cpp
@@ -16,138 +16,149 @@
16 along with this library; see the file COPYING.LIB. If not, write to 16 along with this library; see the file COPYING.LIB. If not, write to
17 the Free Software Foundation, Inc., 59 Temple Place - Suite 330, 17 the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
18 Boston, MA 02111-1307, USA. 18 Boston, MA 02111-1307, USA.
19*/ 19*/
20 20
21#include <kglobal.h> 21#include <kglobal.h>
22#include <kglobalsettings.h> 22#include <kglobalsettings.h>
23#include <klocale.h> 23#include <klocale.h>
24#include <kdebug.h> 24#include <kdebug.h>
25#include <qregexp.h> 25#include <qregexp.h>
26#include <qfileinfo.h> 26#include <qfileinfo.h>
27 27
28#include "calendarlocal.h" 28#include "calendarlocal.h"
29#include "icalformat.h" 29#include "icalformat.h"
30#include "todo.h" 30#include "todo.h"
31 31
32using namespace KCal; 32using namespace KCal;
33 33
34Todo::Todo(): QObject(), Incidence() 34Todo::Todo(): QObject(), Incidence()
35{ 35{
36// mStatus = TENTATIVE; 36// mStatus = TENTATIVE;
37 37
38 mHasDueDate = false; 38 mHasDueDate = false;
39 setHasStartDate( false ); 39 setHasStartDate( false );
40 mCompleted = getEvenTime(QDateTime::currentDateTime()); 40 mCompleted = getEvenTime(QDateTime::currentDateTime());
41 mHasCompletedDate = false; 41 mHasCompletedDate = false;
42 mPercentComplete = 0; 42 mPercentComplete = 0;
43 mRunning = false; 43 mRunning = false;
44 mRunSaveTimer = 0; 44 mRunSaveTimer = 0;
45} 45}
46 46
47Todo::Todo(const Todo &t) : QObject(),Incidence(t) 47Todo::Todo(const Todo &t) : QObject(),Incidence(t)
48{ 48{
49 mDtDue = t.mDtDue; 49 mDtDue = t.mDtDue;
50 mHasDueDate = t.mHasDueDate; 50 mHasDueDate = t.mHasDueDate;
51 mCompleted = t.mCompleted; 51 mCompleted = t.mCompleted;
52 mHasCompletedDate = t.mHasCompletedDate; 52 mHasCompletedDate = t.mHasCompletedDate;
53 mPercentComplete = t.mPercentComplete; 53 mPercentComplete = t.mPercentComplete;
54 mRunning = false; 54 mRunning = false;
55 mRunSaveTimer = 0; 55 mRunSaveTimer = 0;
56} 56}
57 57
58Todo::~Todo() 58Todo::~Todo()
59{ 59{
60 setRunning( false ); 60 setRunning( false );
61 //qDebug("Todo::~Todo() "); 61 //qDebug("Todo::~Todo() ");
62} 62}
63 63
64void Todo::setRunningFalse( QString s )
65{
66 if ( ! mRunning )
67 return;
68 mRunning = false;
69 mRunSaveTimer->stop();
70 saveRunningInfoToFile( s );
71}
64void Todo::setRunning( bool run ) 72void Todo::setRunning( bool run )
65{ 73{
66 if ( run == mRunning ) 74 if ( run == mRunning )
67 return; 75 return;
68 //qDebug("Todo::setRunning %d ", run); 76 //qDebug("Todo::setRunning %d ", run);
69 if ( !mRunSaveTimer ) { 77 if ( !mRunSaveTimer ) {
70 mRunSaveTimer = new QTimer ( this ); 78 mRunSaveTimer = new QTimer ( this );
71 connect ( mRunSaveTimer, SIGNAL( timeout() ), this , SLOT ( saveRunningInfoToFile() ) ); 79 connect ( mRunSaveTimer, SIGNAL( timeout() ), this , SLOT ( saveRunningInfoToFile() ) );
72 } 80 }
73 mRunning = run; 81 mRunning = run;
74 if ( mRunning ) { 82 if ( mRunning ) {
75 mRunSaveTimer->start( 1000 * 60 * 5 ); // 5 min 83 mRunSaveTimer->start( 1000 * 60 * 5 ); // 5 min
76 mRunStart = QDateTime::currentDateTime(); 84 mRunStart = QDateTime::currentDateTime();
77 } else { 85 } else {
78 mRunSaveTimer->stop(); 86 mRunSaveTimer->stop();
79 saveRunningInfoToFile(); 87 saveRunningInfoToFile();
80 } 88 }
81} 89}
82 90
83void Todo::saveRunningInfoToFile() 91void Todo::saveRunningInfoToFile( QString comment )
84{ 92{
85 //qDebug("Todo::saveRunningInfoToFile() %s", summary().latin1()); 93 //qDebug("Todo::saveRunningInfoToFile() %s", summary().latin1());
86 if ( mRunStart.secsTo ( QDateTime::currentDateTime() ) < 30 ) { 94 if ( mRunStart.secsTo ( QDateTime::currentDateTime() ) < 30 ) {
87 qDebug("Running time < 30 seconds. Skipped. "); 95 qDebug("Running time < 30 seconds. Skipped. ");
88 return; 96 return;
89 } 97 }
90 QString dir = KGlobalSettings::timeTrackerDir(); 98 QString dir = KGlobalSettings::timeTrackerDir();
91 //qDebug("%s ", dir.latin1()); 99 //qDebug("%s ", dir.latin1());
92 QString file = "%1%2%3-%4%5%6-"; 100 QString file = "%1%2%3-%4%5%6-";
93 file = file.arg( mRunStart.date().year(), 4).arg( mRunStart.date().month(),2 ).arg( mRunStart.date().day(), 2 ).arg( mRunStart.time().hour(),2 ).arg( mRunStart.time().minute(),2 ).arg( mRunStart.time().second(),2 ); 101 file = file.arg( mRunStart.date().year(), 4).arg( mRunStart.date().month(),2 ).arg( mRunStart.date().day(), 2 ).arg( mRunStart.time().hour(),2 ).arg( mRunStart.time().minute(),2 ).arg( mRunStart.time().second(),2 );
94 file.replace ( QRegExp (" "), "0" ); 102 file.replace ( QRegExp (" "), "0" );
95 file += uid(); 103 file += uid();
96 //qDebug("File %s ",file.latin1() ); 104 //qDebug("File %s ",file.latin1() );
97 CalendarLocal cal; 105 CalendarLocal cal;
98 cal.setLocalTime(); 106 cal.setLocalTime();
99 Todo * to = (Todo*) clone(); 107 Todo * to = (Todo*) clone();
100 to->setFloats( false ); 108 to->setFloats( false );
101 to->setDtStart( mRunStart ); 109 to->setDtStart( mRunStart );
102 to->setHasStartDate( true ); 110 to->setHasStartDate( true );
103 to->setDtDue( QDateTime::currentDateTime() ); 111 to->setDtDue( QDateTime::currentDateTime() );
104 to->setHasDueDate( true ); 112 to->setHasDueDate( true );
105 to->setUid( file ); 113 to->setUid( file );
114 if ( !comment.isEmpty() ) {
115 to->setDescription( comment );
116 }
106 cal.addIncidence( to ); 117 cal.addIncidence( to );
107 ICalFormat format; 118 ICalFormat format;
108 file = dir +"/" +file +".ics"; 119 file = dir +"/" +file +".ics";
109 format.save( &cal, file ); 120 format.save( &cal, file );
110 saveParents(); 121 saveParents();
111 122
112} 123}
113void Todo::saveParents() 124void Todo::saveParents()
114{ 125{
115 if (!relatedTo() ) 126 if (!relatedTo() )
116 return; 127 return;
117 Incidence * inc = relatedTo(); 128 Incidence * inc = relatedTo();
118 if ( inc->type() != "Todo" ) 129 if ( inc->type() != "Todo" )
119 return; 130 return;
120 Todo* to = (Todo*)inc; 131 Todo* to = (Todo*)inc;
121 bool saveTodo = false; 132 bool saveTodo = false;
122 QString file = KGlobalSettings::timeTrackerDir() + "/"+ to->uid() + ".ics"; 133 QString file = KGlobalSettings::timeTrackerDir() + "/"+ to->uid() + ".ics";
123 QFileInfo fi ( file ); 134 QFileInfo fi ( file );
124 if ( fi.exists() ) { 135 if ( fi.exists() ) {
125 if ( fi.lastModified () < to->lastModified ()) 136 if ( fi.lastModified () < to->lastModified ())
126 saveTodo = true; 137 saveTodo = true;
127 } else { 138 } else {
128 saveTodo = true; 139 saveTodo = true;
129 } 140 }
130 if ( saveTodo ) { 141 if ( saveTodo ) {
131 CalendarLocal cal; 142 CalendarLocal cal;
132 cal.setLocalTime(); 143 cal.setLocalTime();
133 Todo * par = (Todo *) to->clone(); 144 Todo * par = (Todo *) to->clone();
134 cal.addIncidence( par ); 145 cal.addIncidence( par );
135 ICalFormat format; 146 ICalFormat format;
136 format.save( &cal, file ); 147 format.save( &cal, file );
137 } 148 }
138 to->saveParents(); 149 to->saveParents();
139} 150}
140 151
141int Todo::runTime() 152int Todo::runTime()
142{ 153{
143 if ( !mRunning ) 154 if ( !mRunning )
144 return 0; 155 return 0;
145 return mRunStart.secsTo( QDateTime::currentDateTime() ); 156 return mRunStart.secsTo( QDateTime::currentDateTime() );
146} 157}
147bool Todo::hasRunningSub() 158bool Todo::hasRunningSub()
148{ 159{
149 if ( mRunning ) 160 if ( mRunning )
150 return true; 161 return true;
151 Incidence *aTodo; 162 Incidence *aTodo;
152 for (aTodo = mRelations.first(); aTodo; aTodo = mRelations.next()) { 163 for (aTodo = mRelations.first(); aTodo; aTodo = mRelations.next()) {
153 if ( ((Todo*)aTodo)->hasRunningSub() ) 164 if ( ((Todo*)aTodo)->hasRunningSub() )
diff --git a/libkcal/todo.h b/libkcal/todo.h
index ec1ffda..a5354ce 100644
--- a/libkcal/todo.h
+++ b/libkcal/todo.h
@@ -75,75 +75,76 @@ namespace KCal {
75 */ 75 */
76 int hasDueSubTodo( bool checkSubtodos = true ); 76 int hasDueSubTodo( bool checkSubtodos = true );
77 /* same as above, but a specific date can be specified*/ 77 /* same as above, but a specific date can be specified*/
78 int hasDueSubTodoForDate( const QDate & date, bool checkSubtodos ); 78 int hasDueSubTodoForDate( const QDate & date, bool checkSubtodos );
79 79
80 80
81 /** sets the event's status to the string specified. The string 81 /** sets the event's status to the string specified. The string
82 * must be a recognized value for the status field, i.e. a string 82 * must be a recognized value for the status field, i.e. a string
83 * equivalent of the possible status enumerations previously described. */ 83 * equivalent of the possible status enumerations previously described. */
84// void setStatus(const QString &statStr); 84// void setStatus(const QString &statStr);
85 /** sets the event's status to the value specified. See the enumeration 85 /** sets the event's status to the value specified. See the enumeration
86 * above for possible values. */ 86 * above for possible values. */
87// void setStatus(int); 87// void setStatus(int);
88 /** return the event's status. */ 88 /** return the event's status. */
89// int status() const; 89// int status() const;
90 /** return the event's status in string format. */ 90 /** return the event's status in string format. */
91// QString statusStr() const; 91// QString statusStr() const;
92 92
93 /** return, if this todo is completed */ 93 /** return, if this todo is completed */
94 bool isCompleted() const; 94 bool isCompleted() const;
95 /** set completed state of this todo */ 95 /** set completed state of this todo */
96 void setCompleted(bool); 96 void setCompleted(bool);
97 97
98 /** 98 /**
99 Return how many percent of the task are completed. Returns a value 99 Return how many percent of the task are completed. Returns a value
100 between 0 and 100. 100 between 0 and 100.
101 */ 101 */
102 int percentComplete() const; 102 int percentComplete() const;
103 /** 103 /**
104 Set how many percent of the task are completed. Valid values are in the 104 Set how many percent of the task are completed. Valid values are in the
105 range from 0 to 100. 105 range from 0 to 100.
106 */ 106 */
107 void setPercentComplete(int); 107 void setPercentComplete(int);
108 108
109 /** return date and time when todo was completed */ 109 /** return date and time when todo was completed */
110 QDateTime completed() const; 110 QDateTime completed() const;
111 QString completedStr(bool shortF = true) const; 111 QString completedStr(bool shortF = true) const;
112 /** set date and time of completion */ 112 /** set date and time of completion */
113 void setCompleted(const QDateTime &completed); 113 void setCompleted(const QDateTime &completed);
114 114
115 /** Return true, if todo has a date associated with completion */ 115 /** Return true, if todo has a date associated with completion */
116 bool hasCompletedDate() const; 116 bool hasCompletedDate() const;
117 bool contains ( Todo*); 117 bool contains ( Todo*);
118 void checkSetCompletedFalse(); 118 void checkSetCompletedFalse();
119 bool setRecurDates(); 119 bool setRecurDates();
120 bool isRunning() {return mRunning;} 120 bool isRunning() {return mRunning;}
121 bool hasRunningSub(); 121 bool hasRunningSub();
122 void setRunning( bool ); 122 void setRunning( bool );
123 void setRunningFalse( QString );
123 int runTime(); 124 int runTime();
124 QDateTime runStart () const { return mRunStart;} 125 QDateTime runStart () const { return mRunStart;}
125 public slots: 126 public slots:
126 void saveRunningInfoToFile(); 127 void saveRunningInfoToFile( QString st = QString::null );
127 void saveParents(); 128 void saveParents();
128 private: 129 private:
129 bool mRunning; 130 bool mRunning;
130 QTimer * mRunSaveTimer; 131 QTimer * mRunSaveTimer;
131 QDateTime mRunStart; 132 QDateTime mRunStart;
132 bool accept(Visitor &v) { return v.visit(this); } 133 bool accept(Visitor &v) { return v.visit(this); }
133 134
134 QDateTime mDtDue; // due date of todo 135 QDateTime mDtDue; // due date of todo
135 136
136 bool mHasDueDate; // if todo has associated due date 137 bool mHasDueDate; // if todo has associated due date
137 138
138// int mStatus; // confirmed/delegated/tentative/etc 139// int mStatus; // confirmed/delegated/tentative/etc
139 140
140 QDateTime mCompleted; 141 QDateTime mCompleted;
141 bool mHasCompletedDate; 142 bool mHasCompletedDate;
142 143
143 int mPercentComplete; 144 int mPercentComplete;
144}; 145};
145 146
146 bool operator==( const Todo&, const Todo& ); 147 bool operator==( const Todo&, const Todo& );
147} 148}
148 149
149#endif 150#endif
diff --git a/qtcompat/qinputdialog.cpp b/qtcompat/qinputdialog.cpp
index 64c581e..ce46118 100644
--- a/qtcompat/qinputdialog.cpp
+++ b/qtcompat/qinputdialog.cpp
@@ -263,97 +263,97 @@ QInputDialog::~QInputDialog()
263{ 263{
264 delete d; 264 delete d;
265} 265}
266 266
267/*! 267/*!
268 Static convenience function to get a textual input from the user. \a caption is the text 268 Static convenience function to get a textual input from the user. \a caption is the text
269 which is displayed in the title bar of the dialog. \a label is the text which 269 which is displayed in the title bar of the dialog. \a label is the text which
270 is shown to the user (it should mention to the user what he/she should input), \a text 270 is shown to the user (it should mention to the user what he/she should input), \a text
271 the default text which will be initially set to the line edit, \a ok a pointer to 271 the default text which will be initially set to the line edit, \a ok a pointer to
272 a bool which will be (if not 0!) set to TRUE if the user pressed ok or to FALSE if the 272 a bool which will be (if not 0!) set to TRUE if the user pressed ok or to FALSE if the
273 user pressed cancel, \a parent the parent widget of the dialog and \a name 273 user pressed cancel, \a parent the parent widget of the dialog and \a name
274 the name of it. The dialogs pops up modally! 274 the name of it. The dialogs pops up modally!
275 275
276 This method returns the text which has been entered in the line edit. 276 This method returns the text which has been entered in the line edit.
277 277
278 You will use this static method like this: 278 You will use this static method like this:
279 279
280 \code 280 \code
281 bool ok = FALSE; 281 bool ok = FALSE;
282 QString text = QInputDialog::getText( tr( "Please enter your name" ), QString::null, &ok, this ); 282 QString text = QInputDialog::getText( tr( "Please enter your name" ), QString::null, &ok, this );
283 if ( ok && !text.isEmpty() ) 283 if ( ok && !text.isEmpty() )
284 ;// user entered something and pressed ok 284 ;// user entered something and pressed ok
285 else 285 else
286 ;// user entered nothing or pressed cancel 286 ;// user entered nothing or pressed cancel
287 \endcode 287 \endcode
288*/ 288*/
289 289
290QString QInputDialog::getText( const QString &caption, const QString &label, const QString &text, 290QString QInputDialog::getText( const QString &caption, const QString &label, const QString &text,
291 bool *ok, QWidget *parent, const char *name ) 291 bool *ok, QWidget *parent, const char *name )
292{ 292{
293 return getText( caption, label, QLineEdit::Normal, text, ok, parent, name ); 293 return getText( caption, label, QLineEdit::Normal, text, ok, parent, name );
294} 294}
295 295
296/*! 296/*!
297 Like above, but accepts an a \a mode which the line edit will use to display text. 297 Like above, but accepts an a \a mode which the line edit will use to display text.
298 298
299 \sa getText() 299 \sa getText()
300*/ 300*/
301 301
302QString QInputDialog::getText( const QString &caption, const QString &label, QLineEdit::EchoMode mode, 302QString QInputDialog::getText( const QString &caption, const QString &label, QLineEdit::EchoMode mode,
303 const QString &text, bool *ok, QWidget *parent, const char *name ) 303 const QString &text, bool *ok, QWidget *parent, const char *name )
304{ 304{
305 QInputDialog *dlg = new QInputDialog( label, parent, name, TRUE, LineEdit ); 305 QInputDialog *dlg = new QInputDialog( label, parent, name, TRUE, LineEdit );
306 dlg->setCaption( caption ); 306 dlg->setCaption( caption );
307 dlg->lineEdit()->setText( text ); 307 dlg->lineEdit()->setText( text );
308 dlg->lineEdit()->setEchoMode( mode ); 308 dlg->lineEdit()->setEchoMode( mode );
309 if ( !text.isEmpty() ) 309 if ( !text.isEmpty() )
310 dlg->lineEdit()->selectAll(); 310 dlg->lineEdit()->selectAll();
311 311 dlg->setMinimumWidth ( 230 );
312 bool ok_ = FALSE; 312 bool ok_ = FALSE;
313 QString result; 313 QString result;
314 ok_ = dlg->exec() == QDialog::Accepted; 314 ok_ = dlg->exec() == QDialog::Accepted;
315 if ( ok ) 315 if ( ok )
316 *ok = ok_; 316 *ok = ok_;
317 if ( ok_ ) 317 if ( ok_ )
318 result = dlg->lineEdit()->text(); 318 result = dlg->lineEdit()->text();
319 319
320 delete dlg; 320 delete dlg;
321 return result; 321 return result;
322} 322}
323 323
324/*! 324/*!
325 Static convenience function to get an integral input from the user. \a caption is the text 325 Static convenience function to get an integral input from the user. \a caption is the text
326 which is displayed in the title bar of the dialog. \a label is the text which 326 which is displayed in the title bar of the dialog. \a label is the text which
327 is shown to the user (it should mention to the user what he/she should input), \a num 327 is shown to the user (it should mention to the user what he/she should input), \a num
328 the default number which will be initially set to the spinbox, \a from and \a to the 328 the default number which will be initially set to the spinbox, \a from and \a to the
329 range in which the entered number has to be, \a step the step in which the number can 329 range in which the entered number has to be, \a step the step in which the number can
330 be increased/decreased by the spinbox, \a ok a pointer to 330 be increased/decreased by the spinbox, \a ok a pointer to
331 a bool which will be (if not 0!) set to TRUE if the user pressed ok or to FALSE if the 331 a bool which will be (if not 0!) set to TRUE if the user pressed ok or to FALSE if the
332 user pressed cancel, \a parent the parent widget of the dialog and \a name 332 user pressed cancel, \a parent the parent widget of the dialog and \a name
333 the name of it. The dialogs pops up modally! 333 the name of it. The dialogs pops up modally!
334 334
335 This method returns the number which has been entered by the user. 335 This method returns the number which has been entered by the user.
336 336
337 You will use this static method like this: 337 You will use this static method like this:
338 338
339 \code 339 \code
340 bool ok = FALSE; 340 bool ok = FALSE;
341 int res = QInputDialog::getInteger( tr( "Please enter a number" ), 22, 0, 1000, 2, &ok, this ); 341 int res = QInputDialog::getInteger( tr( "Please enter a number" ), 22, 0, 1000, 2, &ok, this );
342 if ( ok ) 342 if ( ok )
343 ;// user entered something and pressed ok 343 ;// user entered something and pressed ok
344 else 344 else
345 ;// user pressed cancel 345 ;// user pressed cancel
346 \endcode 346 \endcode
347*/ 347*/
348 348
349int QInputDialog::getInteger( const QString &caption, const QString &label, int num, int from, int to, int step, 349int QInputDialog::getInteger( const QString &caption, const QString &label, int num, int from, int to, int step,
350 bool *ok, QWidget *parent, const char *name ) 350 bool *ok, QWidget *parent, const char *name )
351{ 351{
352 QInputDialog *dlg = new QInputDialog( label, parent, name, TRUE, SpinBox ); 352 QInputDialog *dlg = new QInputDialog( label, parent, name, TRUE, SpinBox );
353 dlg->setCaption( caption ); 353 dlg->setCaption( caption );
354 dlg->spinBox()->setRange( from, to ); 354 dlg->spinBox()->setRange( from, to );
355 dlg->spinBox()->setSteps( step, 0 ); 355 dlg->spinBox()->setSteps( step, 0 );
356 dlg->spinBox()->setValue( num ); 356 dlg->spinBox()->setValue( num );
357 357
358 bool ok_ = FALSE; 358 bool ok_ = FALSE;
359 int result; 359 int result;