summaryrefslogtreecommitdiffabout
path: root/korganizer/kolocationbox.cpp
Unidiff
Diffstat (limited to 'korganizer/kolocationbox.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r--korganizer/kolocationbox.cpp8
1 files changed, 7 insertions, 1 deletions
diff --git a/korganizer/kolocationbox.cpp b/korganizer/kolocationbox.cpp
index 35a8123..9d5aafc 100644
--- a/korganizer/kolocationbox.cpp
+++ b/korganizer/kolocationbox.cpp
@@ -21,76 +21,82 @@
21 21
22 As a special exception, permission is given to link this program 22 As a special exception, permission is given to link this program
23 with any edition of Qt, and distribute the resulting executable, 23 with any edition of Qt, and distribute the resulting executable,
24 without including the source code for Qt in the source distribution. 24 without including the source code for Qt in the source distribution.
25*/ 25*/
26 26
27#include "kolocationbox.h" 27#include "kolocationbox.h"
28#include <qstring.h> 28#include <qstring.h>
29#include <qlineedit.h> 29#include <qlineedit.h>
30#include <qapplication.h> 30#include <qapplication.h>
31 31
32 32
33KOLocationBox::KOLocationBox( bool rw , QWidget *parent , int _maxItems) : 33KOLocationBox::KOLocationBox( bool rw , QWidget *parent , int _maxItems) :
34 QComboBox( rw , parent ) 34 QComboBox( rw , parent )
35{ 35{
36 maxItems = _maxItems; 36 maxItems = _maxItems;
37 maxItems = 50; // sorry - hack from me to set maxitems globally to 30 37 //maxItems = 50; // sorry - hack from me to set maxitems globally to 30
38 setInsertionPolicy(AtTop); 38 setInsertionPolicy(AtTop);
39 setDuplicatesEnabled( FALSE ); 39 setDuplicatesEnabled( FALSE );
40 setMaxCount( maxItems ); 40 setMaxCount( maxItems );
41 setAutoCompletion( TRUE ); 41 setAutoCompletion( TRUE );
42 42
43} 43}
44 44
45KOLocationBox::~KOLocationBox() 45KOLocationBox::~KOLocationBox()
46{ 46{
47} 47}
48 48
49void KOLocationBox::load(int what) 49void KOLocationBox::load(int what)
50{ 50{
51 clear(); 51 clear();
52 // qDebug("load %d ",what ); 52 // qDebug("load %d ",what );
53 switch(what) { 53 switch(what) {
54 case LOCATION: 54 case LOCATION:
55 insertStringList( KOPrefs::instance()->mLocationDefaults, 0 ); 55 insertStringList( KOPrefs::instance()->mLocationDefaults, 0 );
56// insertStringList( KOPrefs::instance()->mLocationUserDefaults, 0 ); 56// insertStringList( KOPrefs::instance()->mLocationUserDefaults, 0 );
57 break; // don't disable 57 break; // don't disable
58 case SUMMARYEVENT: 58 case SUMMARYEVENT:
59 insertStringList( KOPrefs::instance()->mEventSummaryUser, 0 ); 59 insertStringList( KOPrefs::instance()->mEventSummaryUser, 0 );
60 break; // don't disable 60 break; // don't disable
61 case SUMMARYTODO: 61 case SUMMARYTODO:
62 insertStringList( KOPrefs::instance()->mTodoSummaryUser, 0 ); 62 insertStringList( KOPrefs::instance()->mTodoSummaryUser, 0 );
63 break; // don't disable 63 break; // don't disable
64 case SUMMARYJOURNAL:
65 insertStringList( KOPrefs::instance()->mJournalSummaryUser, 0 );
66 break; // don't disable
64 } 67 }
65} 68}
66 69
67void KOLocationBox::save(int what) 70void KOLocationBox::save(int what)
68{ 71{
69 strlist.clear(); 72 strlist.clear();
70 for( int l = 0; l < count() ; l++ ) { 73 for( int l = 0; l < count() ; l++ ) {
71 strlist << text( l ); 74 strlist << text( l );
72 } 75 }
73 // strlist.sort(); 76 // strlist.sort();
74 QString currentLine = lineEdit()->text(); 77 QString currentLine = lineEdit()->text();
75 if ( !strlist.contains( currentLine ) ) 78 if ( !strlist.contains( currentLine ) )
76 strlist.prepend( currentLine ); 79 strlist.prepend( currentLine );
77 // qDebug("save %d ", what); 80 // qDebug("save %d ", what);
78 switch(what) { 81 switch(what) {
79 case LOCATION: 82 case LOCATION:
80 KOPrefs::instance()->mLocationDefaults = strlist; 83 KOPrefs::instance()->mLocationDefaults = strlist;
81// KOPrefs::instance()->mLocationUserDefaults = strlist; 84// KOPrefs::instance()->mLocationUserDefaults = strlist;
82 break; // don't disable 85 break; // don't disable
83 case SUMMARYEVENT: 86 case SUMMARYEVENT:
84 KOPrefs::instance()->mEventSummaryUser = strlist; 87 KOPrefs::instance()->mEventSummaryUser = strlist;
85 break; // don't disable 88 break; // don't disable
86 case SUMMARYTODO: 89 case SUMMARYTODO:
87 KOPrefs::instance()->mTodoSummaryUser = strlist; 90 KOPrefs::instance()->mTodoSummaryUser = strlist;
88 break; // don't disable 91 break; // don't disable
92 case SUMMARYJOURNAL:
93 KOPrefs::instance()->mJournalSummaryUser = strlist;
94 break; // don't disable
89 } 95 }
90} 96}
91 97
92void KOLocationBox::clearItems(int what) 98void KOLocationBox::clearItems(int what)
93{ 99{
94 clear(); 100 clear();
95 save(what); 101 save(what);
96} 102}