summaryrefslogtreecommitdiffabout
authorzautrix <zautrix>2005-04-17 14:27:55 (UTC)
committer zautrix <zautrix>2005-04-17 14:27:55 (UTC)
commitb411ec2d8961d07c3e2e9aefc9e04322b7851859 (patch) (unidiff)
tree79e2a70f1ad32562456b0bfa03aa2b916095fbb0
parent2d81c75c4ffb8f144ae58e90e68496500d07a19e (diff)
downloadkdepimpi-b411ec2d8961d07c3e2e9aefc9e04322b7851859.zip
kdepimpi-b411ec2d8961d07c3e2e9aefc9e04322b7851859.tar.gz
kdepimpi-b411ec2d8961d07c3e2e9aefc9e04322b7851859.tar.bz2
qdebugcleanup
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--kde2file/abdump/main.cpp3
-rw-r--r--kde2file/caldump/main.cpp3
-rw-r--r--korganizer/kdatenavigator.cpp4
-rw-r--r--korganizer/koagendaview.cpp6
-rw-r--r--korganizer/kodaymatrix.cpp1
-rw-r--r--korganizer/koeditorgeneral.cpp2
-rw-r--r--korganizer/koeditorrecurrence.cpp10
-rw-r--r--korganizer/koeventviewer.cpp4
-rw-r--r--korganizer/koglobals.cpp31
-rw-r--r--korganizer/koglobals.h5
-rw-r--r--korganizer/koincidenceeditor.cpp1
-rw-r--r--korganizer/kolistview.cpp9
-rw-r--r--korganizer/kolistview.h2
-rw-r--r--korganizer/komonthview.cpp14
-rw-r--r--korganizer/korganizer.pro2
-rw-r--r--korganizer/korganizerE.pro2
-rw-r--r--korganizer/kotodoview.cpp31
-rw-r--r--korganizer/koviewmanager.cpp10
-rw-r--r--korganizer/kowhatsnextview.cpp2
-rw-r--r--korganizer/ktimeedit.cpp2
-rw-r--r--korganizer/mainwindow.cpp6
-rw-r--r--korganizer/mainwindow.h9
-rw-r--r--korganizer/searchdialog.cpp3
23 files changed, 33 insertions, 129 deletions
diff --git a/kde2file/abdump/main.cpp b/kde2file/abdump/main.cpp
index b359cfe..824d054 100644
--- a/kde2file/abdump/main.cpp
+++ b/kde2file/abdump/main.cpp
@@ -41,129 +41,130 @@
41#include <qdir.h> 41#include <qdir.h>
42#include <qapplication.h> 42#include <qapplication.h>
43 43
44#include <stdlib.h> 44#include <stdlib.h>
45#include <iostream> 45#include <iostream>
46 46
47using namespace std; 47using namespace std;
48 48
49static const char progName[] = "kdecalendar"; 49static const char progName[] = "kdecalendar";
50static const char progDisplay[] = "KDE_Addressbook"; 50static const char progDisplay[] = "KDE_Addressbook";
51static const char progVersion[] = "33.1/3"; 51static const char progVersion[] = "33.1/3";
52static const char progDesc[] = "A command line interface to KDE addressbooks"; 52static const char progDesc[] = "A command line interface to KDE addressbooks";
53 53
54 54
55static KCmdLineOptions options[] = 55static KCmdLineOptions options[] =
56 { 56 {
57 { "dump", 57 { "dump",
58 I18N_NOOP( "Dumps addressbook" ), 0 }, 58 I18N_NOOP( "Dumps addressbook" ), 0 },
59 { "read", 59 { "read",
60 I18N_NOOP( "Reads addressbook" ), 0 }, 60 I18N_NOOP( "Reads addressbook" ), 0 },
61 KCmdLineLastOption 61 KCmdLineLastOption
62 }; 62 };
63 63
64int main( int argc, char *argv[] ) 64int main( int argc, char *argv[] )
65{ 65{
66 KAboutData aboutData( 66 KAboutData aboutData(
67 progName, // internal program name 67 progName, // internal program name
68 I18N_NOOP( progDisplay ), // displayable program name. 68 I18N_NOOP( progDisplay ), // displayable program name.
69 progVersion, // version string 69 progVersion, // version string
70 I18N_NOOP( progDesc ), // short porgram description 70 I18N_NOOP( progDesc ), // short porgram description
71 KAboutData::License_GPL, // license type 71 KAboutData::License_GPL, // license type
72 "(c) 2004, Lutz Rogowski", // copyright statement 72 "(c) 2004, Lutz Rogowski", // copyright statement
73 0, // any free form text 73 0, // any free form text
74 "", // program home page address 74 "", // program home page address
75 "bugs.kde.org" // bug report email address 75 "bugs.kde.org" // bug report email address
76 ); 76 );
77 77
78 78
79 // KCmdLineArgs::init() final 'true' argument indicates no commandline options 79 // KCmdLineArgs::init() final 'true' argument indicates no commandline options
80 // for QApplication/KApplication (no KDE or Qt options) 80 // for QApplication/KApplication (no KDE or Qt options)
81 KCmdLineArgs::init( argc, argv, &aboutData, true ); 81 KCmdLineArgs::init( argc, argv, &aboutData, true );
82 KCmdLineArgs::addCmdLineOptions( options ); // Add our own options. 82 KCmdLineArgs::addCmdLineOptions( options ); // Add our own options.
83 83
84 KInstance ins ( progName ); 84 KInstance ins ( progName );
85 85
86 KCmdLineArgs *args = KCmdLineArgs::parsedArgs(); 86 KCmdLineArgs *args = KCmdLineArgs::parsedArgs();
87 87
88 bool read = false; 88 bool read = false;
89 if ( args->isSet( "read" ) ) { 89 if ( args->isSet( "read" ) ) {
90 read = true; 90 read = true;
91 qDebug("read "); 91 qDebug("read ");
92 } 92 }
93 QString fileName = QDir::homeDirPath ()+"/.kdeaddressbookdump.vcf"; 93 QString fileName = QDir::homeDirPath ()+"/.kdeaddressbookdump.vcf";
94 94
95 KABC::StdAddressBook* standardAddressBook = KABC::StdAddressBook::self(); 95 KABC::StdAddressBook* standardAddressBook = KABC::StdAddressBook::self();
96 standardAddressBook->setAutomaticSave( false ); 96 standardAddressBook->setAutomaticSave( false );
97 qDebug("************************************* "); 97 qDebug("************************************* ");
98 qDebug("***************kdeABdump************* "); 98 qDebug("***************kdeABdump************* ");
99 qDebug("************************************* "); 99 qDebug("************************************* ");
100 if ( !read ) { 100 if ( !read ) {
101 KABC::AddressBook::Iterator it; 101 KABC::AddressBook::Iterator it;
102 KABC::VCardConverter converter; 102 KABC::VCardConverter converter;
103 QString datastream; 103 QString datastream;
104 for( it = standardAddressBook->begin(); it != standardAddressBook->end(); ++it ) { 104 for( it = standardAddressBook->begin(); it != standardAddressBook->end(); ++it ) {
105 if ( (*it).isEmpty() || ! (*it).resource() ) 105 // if ( (*it).isEmpty() || ! (*it).resource() )
106 if ( (*it).isEmpty() )
106 continue; 107 continue;
107 KABC::Addressee a = ( *it ); 108 KABC::Addressee a = ( *it );
108 QString vcard = converter.createVCard( a ); 109 QString vcard = converter.createVCard( a );
109 vcard += QString("\r\n"); 110 vcard += QString("\r\n");
110 datastream += vcard; 111 datastream += vcard;
111 } 112 }
112 QFile outFile(fileName); 113 QFile outFile(fileName);
113 if ( outFile.open(IO_WriteOnly) ) { 114 if ( outFile.open(IO_WriteOnly) ) {
114 QTextStream t( &outFile ); // use a text stream 115 QTextStream t( &outFile ); // use a text stream
115 t.setEncoding( QTextStream::UnicodeUTF8 ); 116 t.setEncoding( QTextStream::UnicodeUTF8 );
116 t <<datastream; 117 t <<datastream;
117 t << "\r\n\r\n"; 118 t << "\r\n\r\n";
118 outFile.close(); 119 outFile.close();
119 } 120 }
120 } else { 121 } else {
121 //Addressee::List aList;//parseVCards( const QString& vcard ); 122 //Addressee::List aList;//parseVCards( const QString& vcard );
122 KABC::Addressee::List list; 123 KABC::Addressee::List list;
123 int added = 0, changedC = 0, deleted = 0; 124 int added = 0, changedC = 0, deleted = 0;
124 QFile file( fileName ); 125 QFile file( fileName );
125 if ( file.open( IO_ReadOnly ) ) { 126 if ( file.open( IO_ReadOnly ) ) {
126 QTextStream t( &file ); // use a text stream 127 QTextStream t( &file ); // use a text stream
127 t.setEncoding( QTextStream::UnicodeUTF8 ); 128 t.setEncoding( QTextStream::UnicodeUTF8 );
128 QString data; 129 QString data;
129 data = t.read(); 130 data = t.read();
130 file.close(); 131 file.close();
131 KABC::VCardConverter converter; 132 KABC::VCardConverter converter;
132 list = converter.parseVCards( data ); 133 list = converter.parseVCards( data );
133 qDebug("kdeABdump::file has %d entries", list.count()); 134 qDebug("kdeABdump::file has %d entries", list.count());
134 135
135 KABC::Addressee::List::Iterator it; 136 KABC::Addressee::List::Iterator it;
136 for ( it = list.begin();it != list.end();++it) { 137 for ( it = list.begin();it != list.end();++it) {
137 (*it).setChanged( true ); 138 (*it).setChanged( true );
138 bool changed = ((*it).custom( "KADDRESSBOOK", "X-ExternalID" ) == "changed"); 139 bool changed = ((*it).custom( "KADDRESSBOOK", "X-ExternalID" ) == "changed");
139 (*it).removeCustom( "KADDRESSBOOK", "X-ExternalID" ); 140 (*it).removeCustom( "KADDRESSBOOK", "X-ExternalID" );
140 //qDebug("ext %s ", (*it).custom( "KADDRESSBOOK", "X-ExternalID" ).latin1()); 141 //qDebug("ext %s ", (*it).custom( "KADDRESSBOOK", "X-ExternalID" ).latin1());
141 if ( changed ) { 142 if ( changed ) {
142 //qDebug("changed Addressee found! "); 143 //qDebug("changed Addressee found! ");
143 KABC::Addressee std = standardAddressBook->findByUid( (*it).uid() ); 144 KABC::Addressee std = standardAddressBook->findByUid( (*it).uid() );
144 if ( ! std.isEmpty() ) 145 if ( ! std.isEmpty() )
145 (*it).setResource(std.resource()); 146 (*it).setResource(std.resource());
146 standardAddressBook->insertAddressee( (*it) ); 147 standardAddressBook->insertAddressee( (*it) );
147 ++changedC; 148 ++changedC;
148 } else { 149 } else {
149 //maybe added? 150 //maybe added?
150 KABC::Addressee std = standardAddressBook->findByUid( (*it).uid() ); 151 KABC::Addressee std = standardAddressBook->findByUid( (*it).uid() );
151 if ( std.isEmpty() ) { 152 if ( std.isEmpty() ) {
152 standardAddressBook->insertAddressee( (*it) ); 153 standardAddressBook->insertAddressee( (*it) );
153 ++added; 154 ++added;
154 } 155 }
155 } 156 }
156 } 157 }
157 KABC::AddressBook::Iterator itA = standardAddressBook->begin(); 158 KABC::AddressBook::Iterator itA = standardAddressBook->begin();
158 KABC::AddressBook::Iterator it2 ; 159 KABC::AddressBook::Iterator it2 ;
159 while ( itA != standardAddressBook->end() ) { 160 while ( itA != standardAddressBook->end() ) {
160 bool found = false; 161 bool found = false;
161 KABC::Addressee::List::Iterator itL; 162 KABC::Addressee::List::Iterator itL;
162 for ( itL = list.begin();itL != list.end();++itL) { 163 for ( itL = list.begin();itL != list.end();++itL) {
163 if ( (*itL).uid() == (*itA).uid() ) { 164 if ( (*itL).uid() == (*itA).uid() ) {
164 found = true; 165 found = true;
165 break; 166 break;
166 } 167 }
167 } 168 }
168 if ( !found ) { 169 if ( !found ) {
169 it2 = itA; 170 it2 = itA;
diff --git a/kde2file/caldump/main.cpp b/kde2file/caldump/main.cpp
index 9cc1a73..c8755cd 100644
--- a/kde2file/caldump/main.cpp
+++ b/kde2file/caldump/main.cpp
@@ -68,129 +68,130 @@ static const char progDisplay[] = "KDE_Calendar";
68static const char progVersion[] = "33.1/3"; 68static const char progVersion[] = "33.1/3";
69static const char progDesc[] = "A command line interface to KDE calendars"; 69static const char progDesc[] = "A command line interface to KDE calendars";
70 70
71 71
72static KCmdLineOptions options[] = 72static KCmdLineOptions options[] =
73 { 73 {
74 { "dump", 74 { "dump",
75 I18N_NOOP( "Dumps calendar" ), 0 }, 75 I18N_NOOP( "Dumps calendar" ), 0 },
76 { "read", 76 { "read",
77 I18N_NOOP( "Reads calendar" ), 0 }, 77 I18N_NOOP( "Reads calendar" ), 0 },
78 KCmdLineLastOption 78 KCmdLineLastOption
79 }; 79 };
80 80
81int main( int argc, char *argv[] ) 81int main( int argc, char *argv[] )
82{ 82{
83 KAboutData aboutData( 83 KAboutData aboutData(
84 progName, // internal program name 84 progName, // internal program name
85 I18N_NOOP( progDisplay ), // displayable program name. 85 I18N_NOOP( progDisplay ), // displayable program name.
86 progVersion, // version string 86 progVersion, // version string
87 I18N_NOOP( progDesc ), // short porgram description 87 I18N_NOOP( progDesc ), // short porgram description
88 KAboutData::License_GPL, // license type 88 KAboutData::License_GPL, // license type
89 "(c) 2004, Lutz Rogowski", // copyright statement 89 "(c) 2004, Lutz Rogowski", // copyright statement
90 0, // any free form text 90 0, // any free form text
91 "", // program home page address 91 "", // program home page address
92 "bugs.kde.org" // bug report email address 92 "bugs.kde.org" // bug report email address
93 ); 93 );
94 94
95 95
96 // KCmdLineArgs::init() final 'true' argument indicates no commandline options 96 // KCmdLineArgs::init() final 'true' argument indicates no commandline options
97 // for QApplication/KApplication (no KDE or Qt options) 97 // for QApplication/KApplication (no KDE or Qt options)
98 KCmdLineArgs::init( argc, argv, &aboutData, true ); 98 KCmdLineArgs::init( argc, argv, &aboutData, true );
99 KCmdLineArgs::addCmdLineOptions( options ); // Add our own options. 99 KCmdLineArgs::addCmdLineOptions( options ); // Add our own options.
100 100
101 KInstance ins ( progName ); 101 KInstance ins ( progName );
102 102
103 KCmdLineArgs *args = KCmdLineArgs::parsedArgs(); 103 KCmdLineArgs *args = KCmdLineArgs::parsedArgs();
104 104
105 bool read = false; 105 bool read = false;
106 if ( args->isSet( "read" ) ) { 106 if ( args->isSet( "read" ) ) {
107 read = true; 107 read = true;
108 qDebug("read "); 108 qDebug("read ");
109 } 109 }
110 QString fileName = QDir::homeDirPath ()+"/.kdecalendardump.ics"; 110 QString fileName = QDir::homeDirPath ()+"/.kdecalendardump.ics";
111 CalendarResources *calendarResource = 0; 111 CalendarResources *calendarResource = 0;
112 CalendarLocal *localCalendar = 0; 112 CalendarLocal *localCalendar = 0;
113 KConfig c( locate( "config", "korganizerrc" ) ); 113 KConfig c( locate( "config", "korganizerrc" ) );
114 c.setGroup( "Time & Date" ); 114 c.setGroup( "Time & Date" );
115 QString tz = c.readEntry( "TimeZoneId" ); 115 QString tz = c.readEntry( "TimeZoneId" );
116 calendarResource = new CalendarResources( tz ); 116 calendarResource = new CalendarResources( tz );
117 calendarResource->readConfig(); 117 calendarResource->readConfig();
118 calendarResource->load(); 118 calendarResource->load();
119 qDebug("************************************* "); 119 qDebug("************************************* ");
120 qDebug("**************kdecaldump************* "); 120 qDebug("**************kdecaldump************* ");
121 qDebug("************************************* "); 121 qDebug("************************************* ");
122 qDebug("Using timezone ID: %s", calendarResource->timeZoneId().latin1()); 122 qDebug("Using timezone ID: %s", calendarResource->timeZoneId().latin1());
123 123
124 if ( !read ) { 124 if ( !read ) {
125 localCalendar = new CalendarLocal(); 125 localCalendar = new CalendarLocal();
126 localCalendar->setTimeZoneId( calendarResource->timeZoneId()); 126 localCalendar->setTimeZoneId( calendarResource->timeZoneId());
127 KCal::Incidence::List allInc = calendarResource->rawIncidences(); 127 KCal::Incidence::List allInc = calendarResource->rawIncidences();
128 Incidence::List::ConstIterator it; 128 Incidence::List::ConstIterator it;
129 int num = 0; 129 int num = 0;
130 for( it = allInc.begin(); it != allInc.end(); ++it ) { 130 for( it = allInc.begin(); it != allInc.end(); ++it ) {
131 ResourceCalendar * re = calendarResource->resource( (*it) ); 131 ResourceCalendar * re = calendarResource->resource( (*it) );
132 if ( re ) { 132 //if ( re )
133 {
133 ++num; 134 ++num;
134 Incidence* cl = (*it)->clone(); 135 Incidence* cl = (*it)->clone();
135 cl->setLastModified( (*it)->lastModified() ); 136 cl->setLastModified( (*it)->lastModified() );
136 if ( cl->type() == "Journal" ) 137 if ( cl->type() == "Journal" )
137 localCalendar->addJournal( (Journal *) cl ); 138 localCalendar->addJournal( (Journal *) cl );
138 else if ( cl->type() == "Todo" ) 139 else if ( cl->type() == "Todo" )
139 localCalendar->addTodo( (Todo *) cl ); 140 localCalendar->addTodo( (Todo *) cl );
140 else if ( cl->type() == "Event" ) 141 else if ( cl->type() == "Event" )
141 localCalendar->addEvent( (Event *) cl ); 142 localCalendar->addEvent( (Event *) cl );
142 } 143 }
143 } 144 }
144 145
145 FileStorage* storage = new FileStorage( calendarResource ); 146 FileStorage* storage = new FileStorage( calendarResource );
146 storage->setFileName( fileName ); 147 storage->setFileName( fileName );
147 storage->setSaveFormat( new ICalFormat() ); 148 storage->setSaveFormat( new ICalFormat() );
148 storage->save(); 149 storage->save();
149 delete storage; 150 delete storage;
150 qDebug("************************************* "); 151 qDebug("************************************* ");
151 qDebug("************kdecaldump*************** "); 152 qDebug("************kdecaldump*************** ");
152 qDebug("************************************* "); 153 qDebug("************************************* ");
153 qDebug("%d calendar entries dumped to file %s", num, fileName.latin1()); 154 qDebug("%d calendar entries dumped to file %s", num, fileName.latin1());
154 155
155 } else { 156 } else {
156 qDebug("************load"); 157 qDebug("************load");
157 localCalendar = new CalendarLocal(); 158 localCalendar = new CalendarLocal();
158 localCalendar->setTimeZoneId( calendarResource->timeZoneId()); 159 localCalendar->setTimeZoneId( calendarResource->timeZoneId());
159 FileStorage* storage = new FileStorage( localCalendar ); 160 FileStorage* storage = new FileStorage( localCalendar );
160 storage->setFileName( fileName ); 161 storage->setFileName( fileName );
161 int num = 0; 162 int num = 0;
162 int del = 0; 163 int del = 0;
163 int add = 0; 164 int add = 0;
164 if ( storage->load() ) { 165 if ( storage->load() ) {
165 qDebug("***********loaded!"); 166 qDebug("***********loaded!");
166 KCal::Incidence::List newInc = localCalendar->rawIncidences(); 167 KCal::Incidence::List newInc = localCalendar->rawIncidences();
167 Incidence::List::ConstIterator it; 168 Incidence::List::ConstIterator it;
168 for( it = newInc.begin(); it != newInc.end(); ++it ) { 169 for( it = newInc.begin(); it != newInc.end(); ++it ) {
169 if ( (*it)->pilotId() > 1 ) { //changed 170 if ( (*it)->pilotId() > 1 ) { //changed
170 qDebug("*********pilot id %d %s ",(*it)->pilotId() ,(*it)->summary().latin1()); 171 qDebug("*********pilot id %d %s ",(*it)->pilotId() ,(*it)->summary().latin1());
171 Incidence *incOld = calendarResource->incidence( (*it)->uid() ); 172 Incidence *incOld = calendarResource->incidence( (*it)->uid() );
172 ResourceCalendar * res = 0; 173 ResourceCalendar * res = 0;
173 if ( incOld ) 174 if ( incOld )
174 res = calendarResource->resource( incOld ); 175 res = calendarResource->resource( incOld );
175 if ( res ) { 176 if ( res ) {
176 Incidence* cl = (*it)->clone(); 177 Incidence* cl = (*it)->clone();
177 cl->setPilotId( incOld->pilotId() ); 178 cl->setPilotId( incOld->pilotId() );
178 ++num; 179 ++num;
179 if ( incOld->type() == "Journal" ) 180 if ( incOld->type() == "Journal" )
180 calendarResource->deleteJournal( (Journal *) incOld ); 181 calendarResource->deleteJournal( (Journal *) incOld );
181 else if ( incOld->type() == "Todo" ) 182 else if ( incOld->type() == "Todo" )
182 calendarResource->deleteTodo( (Todo *) incOld ); 183 calendarResource->deleteTodo( (Todo *) incOld );
183 else if ( incOld->type() == "Event" ) 184 else if ( incOld->type() == "Event" )
184 calendarResource->deleteEvent( (Event *) incOld ); 185 calendarResource->deleteEvent( (Event *) incOld );
185 qDebug("*********change incidence %s ",cl->summary().latin1()); 186 qDebug("*********change incidence %s ",cl->summary().latin1());
186 if ( cl->type() == "Journal" ) 187 if ( cl->type() == "Journal" )
187 calendarResource->addJournal( (Journal *) cl, res ); 188 calendarResource->addJournal( (Journal *) cl, res );
188 else if ( cl->type() == "Todo" ) 189 else if ( cl->type() == "Todo" )
189 calendarResource->addTodo( (Todo *) cl, res ); 190 calendarResource->addTodo( (Todo *) cl, res );
190 else if ( cl->type() == "Event" ) 191 else if ( cl->type() == "Event" )
191 calendarResource->addEvent( (Event *) cl, res ); 192 calendarResource->addEvent( (Event *) cl, res );
192 193
193 } else { 194 } else {
194 Incidence* cl = (*it)->clone(); 195 Incidence* cl = (*it)->clone();
195 qDebug("*********add incidence %s ",cl->summary().latin1()); 196 qDebug("*********add incidence %s ",cl->summary().latin1());
196 calendarResource->addIncidence( cl ); 197 calendarResource->addIncidence( cl );
diff --git a/korganizer/kdatenavigator.cpp b/korganizer/kdatenavigator.cpp
index 5aa1c9b..6697602 100644
--- a/korganizer/kdatenavigator.cpp
+++ b/korganizer/kdatenavigator.cpp
@@ -84,133 +84,131 @@ KDateNavigator::KDateNavigator( QWidget *parent, const char *name )
84 headings[i]->setAlignment(AlignCenter); 84 headings[i]->setAlignment(AlignCenter);
85 headings[i]->installEventFilter(this); 85 headings[i]->installEventFilter(this);
86 86
87 topLayout->addWidget(headings[i],1,i+1); 87 topLayout->addWidget(headings[i],1,i+1);
88 } 88 }
89 89
90 // Create the weeknumber labels 90 // Create the weeknumber labels
91 for( i = 0; i < 6; i++ ) { 91 for( i = 0; i < 6; i++ ) {
92 weeknos[i] = new QLabel(this); 92 weeknos[i] = new QLabel(this);
93 weeknos[i]->setAlignment(AlignCenter ); 93 weeknos[i]->setAlignment(AlignCenter );
94 //weeknos[i]->setFont(QFont("Arial", 10)); 94 //weeknos[i]->setFont(QFont("Arial", 10));
95 if(!m_bShowWeekNums) { 95 if(!m_bShowWeekNums) {
96 weeknos[i]->hide(); 96 weeknos[i]->hide();
97 } 97 }
98 weeknos[i]->installEventFilter(this); 98 weeknos[i]->installEventFilter(this);
99 99
100 topLayout->addWidget(weeknos[i],i+2,0); 100 topLayout->addWidget(weeknos[i],i+2,0);
101 } 101 }
102 102
103 daymatrix = new KODayMatrix( this, "KDateNavigator::DayMatrix"); 103 daymatrix = new KODayMatrix( this, "KDateNavigator::DayMatrix");
104 daymatrix->setFrameStyle(QFrame::Panel|QFrame::Sunken); 104 daymatrix->setFrameStyle(QFrame::Panel|QFrame::Sunken);
105 daymatrix->setLineWidth(1); 105 daymatrix->setLineWidth(1);
106 106
107 connect( daymatrix, SIGNAL( selected( const KCal::DateList & ) ), 107 connect( daymatrix, SIGNAL( selected( const KCal::DateList & ) ),
108 SIGNAL( datesSelected( const KCal::DateList & ) ) ); 108 SIGNAL( datesSelected( const KCal::DateList & ) ) );
109 109
110 connect( daymatrix, SIGNAL( eventDropped( Event * ) ), 110 connect( daymatrix, SIGNAL( eventDropped( Event * ) ),
111 SIGNAL( eventDropped( Event * ) ) ); 111 SIGNAL( eventDropped( Event * ) ) );
112 112
113 topLayout->addMultiCellWidget(daymatrix,2,7,1,7); 113 topLayout->addMultiCellWidget(daymatrix,2,7,1,7);
114 114
115 // read settings from configuration file. 115 // read settings from configuration file.
116 updateConfig(); 116 updateConfig();
117 enableRollover(FollowMonth); 117 enableRollover(FollowMonth);
118 mySizeHint = sizeHintTwoButtons(); 118 mySizeHint = sizeHintTwoButtons();
119 myFullSizeHint = sizeHintTwoButtons( 4 ); 119 myFullSizeHint = sizeHintTwoButtons( 4 );
120 mFontChanged = false; 120 mFontChanged = false;
121 //resize ( 3,3 ); 121 //resize ( 3,3 );
122 122
123} 123}
124void KDateNavigator::changeFont ( QFont fo ) 124void KDateNavigator::changeFont ( QFont fo )
125{ 125{
126 setFont( fo ); 126 setFont( fo );
127 mNavigatorBar->resetFont( fo ); 127 mNavigatorBar->resetFont( fo );
128} 128}
129QFont KDateNavigator::yourFontHint( QSize si , bool *b) 129QFont KDateNavigator::yourFontHint( QSize si , bool *b)
130{ 130{
131 QFont fo = KOPrefs::instance()->mDateNavigatorFont; 131 QFont fo = KOPrefs::instance()->mDateNavigatorFont;
132 *b = false; 132 *b = false;
133 int fontPoint = fo.pointSize(); 133 int fontPoint = fo.pointSize();
134 while ( fontPoint > 5 ) { 134 while ( fontPoint > 5 ) {
135 --fontPoint; 135 --fontPoint;
136 fo.setPointSize( fontPoint ); 136 fo.setPointSize( fontPoint );
137 setFont( fo ); 137 setFont( fo );
138 mFontChanged = true; 138 mFontChanged = true;
139 mNavigatorBar->resetFont( fo ); 139 mNavigatorBar->resetFont( fo );
140 QSize sh = sizeHintTwoButtons( 2 ); 140 QSize sh = sizeHintTwoButtons( 2 );
141 //qDebug("fp %d %d %d %d %d", fontPoint, si.width() , sh.width() , si.height() , sh.height() ); 141 //qDebug("fp %d %d %d %d %d", fontPoint, si.width() , sh.width() , si.height() , sh.height() );
142 if ( si.width() > sh.width() && si.height() > sh.height()) { 142 if ( si.width() > sh.width() && si.height() > sh.height()) {
143 if ( si.width() / sh.width() == 1 ) { 143 if ( si.width() / sh.width() == 1 ) {
144 if ( si.width() < sizeHintTwoButtons( 4 ).width()) 144 if ( si.width() < sizeHintTwoButtons( 4 ).width())
145 continue; 145 continue;
146 } 146 }
147 *b = true; 147 *b = true;
148 //qDebug("fooooooooooooooooooooooouuuuund ");
149 break; 148 break;
150 } 149 }
151 } 150 }
152 //qDebug("returnnnnnnnnnnnnnnnnnnn %d", fo.pointSize() );
153 return fo; 151 return fo;
154} 152}
155QSize KDateNavigator::sizeHint() const 153QSize KDateNavigator::sizeHint() const
156{ 154{
157 QFontMetrics fm ( font() ); 155 QFontMetrics fm ( font() );
158 QSize day = daymatrix->sizeHint(); 156 QSize day = daymatrix->sizeHint();
159 QSize nav = mNavigatorBar->sizeHint(); 157 QSize nav = mNavigatorBar->sizeHint();
160 int wid = fm.width( "30") + day.width()+3; 158 int wid = fm.width( "30") + day.width()+3;
161 int hei = fm.height() +day.height()+nav.height()+2; 159 int hei = fm.height() +day.height()+nav.height()+2;
162 if ( wid < nav.width() ) 160 if ( wid < nav.width() )
163 wid = nav.width() ; 161 wid = nav.width() ;
164 //qDebug("KDateNavigator+++++++++++++ %d %d", wid , hei); 162 //qDebug("KDateNavigator+++++++++++++ %d %d", wid , hei);
165 return QSize ( wid, hei ); 163 return QSize ( wid, hei );
166} 164}
167QSize KDateNavigator::sizeHintTwoButtons( int butnum ) const 165QSize KDateNavigator::sizeHintTwoButtons( int butnum ) const
168{ 166{
169 QFontMetrics fm ( font() ); 167 QFontMetrics fm ( font() );
170 QSize day = daymatrix->sizeHint(); 168 QSize day = daymatrix->sizeHint();
171 QSize nav = mNavigatorBar->sizeHintTwoButtons( butnum ); 169 QSize nav = mNavigatorBar->sizeHintTwoButtons( butnum );
172 int wid = fm.width( "30") + day.width()+3; 170 int wid = fm.width( "30") + day.width()+3;
173 int hei = fm.height() +day.height()+nav.height()+2; 171 int hei = fm.height() +day.height()+nav.height()+2;
174 if ( wid < nav.width() ) 172 if ( wid < nav.width() )
175 wid = nav.width() ; 173 wid = nav.width() ;
176 //qDebug("KDateNavigator+++++++++++++ %d %d", wid , hei); 174 //qDebug("KDateNavigator+++++++++++++ %d %d", wid , hei);
177 return QSize ( wid, hei ); 175 return QSize ( wid, hei );
178} 176}
179void KDateNavigator::slotMonthSelected( int m ) 177void KDateNavigator::slotMonthSelected( int m )
180{ 178{
181 if ( m_MthYr.month() <= mMonthSignalOffset) 179 if ( m_MthYr.month() <= mMonthSignalOffset)
182 m += 12; 180 m += 12;
183 //qDebug("%d mMonthSignalOffset %d emit %d", m, mMonthSignalOffset, m - mMonthSignalOffset); 181 //qDebug("%d mMonthSignalOffset %d emit %d", m, mMonthSignalOffset, m - mMonthSignalOffset);
184 emit monthSelected( m - mMonthSignalOffset ); 182 emit monthSelected( m - mMonthSignalOffset );
185 183
186} 184}
187void KDateNavigator::setCalendar( Calendar *cal ) 185void KDateNavigator::setCalendar( Calendar *cal )
188{ 186{
189 daymatrix->setCalendar( cal ); 187 daymatrix->setCalendar( cal );
190} 188}
191 189
192void KDateNavigator::setBaseDate( const QDate &date , bool doRepaint ) // = true 190void KDateNavigator::setBaseDate( const QDate &date , bool doRepaint ) // = true
193{ 191{
194 m_MthYr = date; 192 m_MthYr = date;
195 //qDebug("KDateNavigator::setBaseDate %s ", date.toString().latin1()); 193 //qDebug("KDateNavigator::setBaseDate %s ", date.toString().latin1());
196 194
197 updateDates(); 195 updateDates();
198 updateView(); 196 updateView();
199 197
200 KCal::DateList dates; 198 KCal::DateList dates;
201 dates.append( date ); 199 dates.append( date );
202 mNavigatorBar->selectDates( dates ); 200 mNavigatorBar->selectDates( dates );
203 201
204 daymatrix->clearSelection(); 202 daymatrix->clearSelection();
205 if ( doRepaint ) 203 if ( doRepaint )
206 daymatrix->repaint( false ); 204 daymatrix->repaint( false );
207} 205}
208 206
209void KDateNavigator::enableRollover(RolloverType r) 207void KDateNavigator::enableRollover(RolloverType r)
210{ 208{
211 switch(r) 209 switch(r)
212 { 210 {
213 case None : 211 case None :
214 if (updateTimer) 212 if (updateTimer)
215 { 213 {
216 updateTimer->stop(); 214 updateTimer->stop();
@@ -307,129 +305,129 @@ void KDateNavigator::updateDates()
307 305
308void KDateNavigator::updateDayMatrix() 306void KDateNavigator::updateDayMatrix()
309{ 307{
310 daymatrix->updateView(); 308 daymatrix->updateView();
311 //daymatrix->repaint(); 309 //daymatrix->repaint();
312} 310}
313 311
314 312
315void KDateNavigator::updateView() 313void KDateNavigator::updateView()
316{ 314{
317 315
318 setUpdatesEnabled( false ); 316 setUpdatesEnabled( false );
319 317
320 int i; 318 int i;
321 319
322// kdDebug() << "updateView() -> daymatrix->updateView()" << endl; 320// kdDebug() << "updateView() -> daymatrix->updateView()" << endl;
323 daymatrix->updateView(); 321 daymatrix->updateView();
324 int sub = 4; 322 int sub = 4;
325 if ( ! KGlobal::locale()->weekStartsMonday() ) 323 if ( ! KGlobal::locale()->weekStartsMonday() )
326 --sub; 324 --sub;
327 // set the week numbers. 325 // set the week numbers.
328 for(i = 0; i < 6; i++) { 326 for(i = 0; i < 6; i++) {
329 // remember, according to ISO 8601, the first week of the year is the 327 // remember, according to ISO 8601, the first week of the year is the
330 // first week that contains a thursday. Thus we must subtract off 4, 328 // first week that contains a thursday. Thus we must subtract off 4,
331 // not just 1. 329 // not just 1.
332 330
333 //ET int dayOfYear = buttons[(i + 1) * 7 - 4]->date().dayOfYear(); 331 //ET int dayOfYear = buttons[(i + 1) * 7 - 4]->date().dayOfYear();
334 int dayOfYear = KOGlobals::self()->calendarSystem()->dayOfYear((daymatrix->getDate((i+1)*7-sub))); 332 int dayOfYear = KOGlobals::self()->calendarSystem()->dayOfYear((daymatrix->getDate((i+1)*7-sub)));
335 int weekNo; 333 int weekNo;
336 if (dayOfYear % 7 != 0) 334 if (dayOfYear % 7 != 0)
337 weekNo = (dayOfYear / 7 + 1); 335 weekNo = (dayOfYear / 7 + 1);
338 else 336 else
339 weekNo = (dayOfYear / 7); 337 weekNo = (dayOfYear / 7);
340 weeknos[i]->setText(QString::number( weekNo )); 338 weeknos[i]->setText(QString::number( weekNo ));
341 } 339 }
342 340
343 setUpdatesEnabled( true ); 341 setUpdatesEnabled( true );
344// kdDebug() << "updateView() -> repaint()" << endl; 342// kdDebug() << "updateView() -> repaint()" << endl;
345 repaint(); 343 repaint();
346 // daymatrix->repaint(); 344 // daymatrix->repaint();
347} 345}
348 346
349void KDateNavigator::updateConfig() 347void KDateNavigator::updateConfig()
350{ 348{
351 int day; 349 int day;
352 for(int i=0; i<7; i++) { 350 for(int i=0; i<7; i++) {
353 // take the first letter of the day name to be the abbreviation 351 // take the first letter of the day name to be the abbreviation
354 if (KGlobal::locale()->weekStartsMonday()) { 352 if (KGlobal::locale()->weekStartsMonday()) {
355 day = i+1; 353 day = i+1;
356 } else { 354 } else {
357 if (i==0) day = 7; 355 if (i==0) day = 7;
358 else day = i; 356 else day = i;
359 } 357 }
360 QString dayName = KOGlobals::self()->calendarSystem()->weekDayName( day, 358 QString dayName = KOGlobals::self()->calendarSystem()->weekDayName( day,
361 true ); 359 true );
362 if ( KOPrefs::instance()->mCompactDialogs ) dayName = dayName.left( 1 ); 360 if ( KOPrefs::instance()->mCompactDialogs ) dayName = dayName.left( 1 );
363 headings[i]->setText( dayName ); 361 headings[i]->setText( dayName );
364 } 362 }
365 updateDates(); 363 updateDates();
366 updateView(); 364 updateView();
367} 365}
368 366
369void KDateNavigator::setShowWeekNums(bool enabled) 367void KDateNavigator::setShowWeekNums(bool enabled)
370{ 368{
371 qDebug("KDateNavigator::setShowWeekNums***************************** "); 369
372 m_bShowWeekNums = enabled; 370 m_bShowWeekNums = enabled;
373 for(int i=0; i<6; i++) { 371 for(int i=0; i<6; i++) {
374 if(enabled) 372 if(enabled)
375 weeknos[i]->show(); 373 weeknos[i]->show();
376 else 374 else
377 weeknos[i]->hide(); 375 weeknos[i]->hide();
378 } 376 }
379 resize(size()); 377 resize(size());
380} 378}
381 379
382void KDateNavigator::selectDates(const DateList& dateList) 380void KDateNavigator::selectDates(const DateList& dateList)
383{ 381{
384 382
385 if (dateList.count() > 0) { 383 if (dateList.count() > 0) {
386 mNavigatorBar->selectDates( dateList ); 384 mNavigatorBar->selectDates( dateList );
387 mSelectedDates = dateList; 385 mSelectedDates = dateList;
388 386
389 // set our record of the month and year that this datetbl is 387 // set our record of the month and year that this datetbl is
390 // displaying. 388 // displaying.
391 m_MthYr = mSelectedDates.first(); 389 m_MthYr = mSelectedDates.first();
392 390
393 391
394 // set our record of the first day of the week of the current 392 // set our record of the first day of the week of the current
395 // month. This needs to be done before calling dayToIndex, since it 393 // month. This needs to be done before calling dayToIndex, since it
396 // relies on this information being up to date. 394 // relies on this information being up to date.
397 QDate dayone(m_MthYr.year(), m_MthYr.month(), 1); 395 QDate dayone(m_MthYr.year(), m_MthYr.month(), 1);
398 m_fstDayOfWk = dayone.dayOfWeek(); 396 m_fstDayOfWk = dayone.dayOfWeek();
399 397
400 updateDates(); 398 updateDates();
401 399
402 daymatrix->setSelectedDaysFrom(*(dateList.begin()), *(--dateList.end())); 400 daymatrix->setSelectedDaysFrom(*(dateList.begin()), *(--dateList.end()));
403 401
404 updateView(); 402 updateView();
405 } 403 }
406} 404}
407 405
408int KDateNavigator::dayNum(int row, int col) 406int KDateNavigator::dayNum(int row, int col)
409{ 407{
410 return 7 * (row - 1) + (col + 1) - m_fstDayOfWk; 408 return 7 * (row - 1) + (col + 1) - m_fstDayOfWk;
411} 409}
412 410
413int KDateNavigator::dayToIndex(int dayNum) 411int KDateNavigator::dayToIndex(int dayNum)
414{ 412{
415 int row, col; 413 int row, col;
416 414
417 row = (dayNum+m_fstDayOfWk-1-(KGlobal::locale()->weekStartsMonday() ? 1 : 0)) / 7; 415 row = (dayNum+m_fstDayOfWk-1-(KGlobal::locale()->weekStartsMonday() ? 1 : 0)) / 7;
418 if (KGlobal::locale()->weekStartsMonday() && (m_fstDayOfWk == 1)) 416 if (KGlobal::locale()->weekStartsMonday() && (m_fstDayOfWk == 1))
419 row++; 417 row++;
420 col = (dayNum+m_fstDayOfWk-1-(KGlobal::locale()->weekStartsMonday() ? 1 : 0)) % 7; 418 col = (dayNum+m_fstDayOfWk-1-(KGlobal::locale()->weekStartsMonday() ? 1 : 0)) % 7;
421 return row * 7 + col; 419 return row * 7 + col;
422} 420}
423 421
424void KDateNavigator::wheelEvent (QWheelEvent *e) 422void KDateNavigator::wheelEvent (QWheelEvent *e)
425{ 423{
426 if(e->delta()>0) emit goPrevious(); 424 if(e->delta()>0) emit goPrevious();
427 else emit goNext(); 425 else emit goNext();
428 426
429 e->accept(); 427 e->accept();
430} 428}
431 429
432bool KDateNavigator::eventFilter (QObject *o,QEvent *e) 430bool KDateNavigator::eventFilter (QObject *o,QEvent *e)
433{ 431{
434 if (e->type() == QEvent::MouseButtonPress) { 432 if (e->type() == QEvent::MouseButtonPress) {
435 int i; 433 int i;
diff --git a/korganizer/koagendaview.cpp b/korganizer/koagendaview.cpp
index b43c40e..b5a4199 100644
--- a/korganizer/koagendaview.cpp
+++ b/korganizer/koagendaview.cpp
@@ -855,129 +855,129 @@ void KOAgendaView::createDayLabels()
855 mDayLabelsFrame->setFixedHeight( newHight + 4 ); 855 mDayLabelsFrame->setFixedHeight( newHight + 4 );
856} 856}
857 857
858int KOAgendaView::maxDatesHint() 858int KOAgendaView::maxDatesHint()
859{ 859{
860 // Not sure about the max number of events, so return 0 for now. 860 // Not sure about the max number of events, so return 0 for now.
861 return 0; 861 return 0;
862} 862}
863 863
864int KOAgendaView::currentDateCount() 864int KOAgendaView::currentDateCount()
865{ 865{
866 return mSelectedDates.count(); 866 return mSelectedDates.count();
867} 867}
868 868
869QPtrList<Incidence> KOAgendaView::selectedIncidences() 869QPtrList<Incidence> KOAgendaView::selectedIncidences()
870{ 870{
871 QPtrList<Incidence> selected; 871 QPtrList<Incidence> selected;
872 Incidence *incidence; 872 Incidence *incidence;
873 873
874 incidence = mAgenda->selectedIncidence(); 874 incidence = mAgenda->selectedIncidence();
875 if (incidence) selected.append(incidence); 875 if (incidence) selected.append(incidence);
876 876
877 incidence = mAllDayAgenda->selectedIncidence(); 877 incidence = mAllDayAgenda->selectedIncidence();
878 if (incidence) selected.append(incidence); 878 if (incidence) selected.append(incidence);
879 879
880 return selected; 880 return selected;
881} 881}
882 882
883DateList KOAgendaView::selectedDates() 883DateList KOAgendaView::selectedDates()
884{ 884{
885 DateList selected; 885 DateList selected;
886 QDate qd; 886 QDate qd;
887 887
888 qd = mAgenda->selectedIncidenceDate(); 888 qd = mAgenda->selectedIncidenceDate();
889 if (qd.isValid()) selected.append(qd); 889 if (qd.isValid()) selected.append(qd);
890 890
891 qd = mAllDayAgenda->selectedIncidenceDate(); 891 qd = mAllDayAgenda->selectedIncidenceDate();
892 if (qd.isValid()) selected.append(qd); 892 if (qd.isValid()) selected.append(qd);
893 893
894 return selected; 894 return selected;
895} 895}
896 896
897 897
898void KOAgendaView::updateView() 898void KOAgendaView::updateView()
899{ 899{
900 if ( mBlockUpdating ) 900 if ( mBlockUpdating )
901 return; 901 return;
902 // kdDebug() << "KOAgendaView::updateView()" << endl; 902 // kdDebug() << "KOAgendaView::updateView()" << endl;
903 fillAgenda(); 903 fillAgenda();
904 904
905} 905}
906 906
907 907
908/* 908/*
909 Update configuration settings for the agenda view. This method is not 909 Update configuration settings for the agenda view. This method is not
910 complete. 910 complete.
911*/ 911*/
912void KOAgendaView::updateConfig() 912void KOAgendaView::updateConfig()
913{ 913{
914 if ( mBlockUpdating ) 914 if ( mBlockUpdating )
915 return; 915 return;
916 if ( mAgenda->height() > 96 * KOPrefs::instance()->mHourSize ) { 916 if ( mAgenda->height() > 96 * KOPrefs::instance()->mHourSize ) {
917 int old = KOPrefs::instance()->mHourSize; 917 int old = KOPrefs::instance()->mHourSize;
918 KOPrefs::instance()->mHourSize = mAgenda->height()/96 +1; 918 KOPrefs::instance()->mHourSize = mAgenda->height()/96 +1;
919 qDebug("KOPrefs::instance()->mHourSize adjusted %d to %d ", old,KOPrefs::instance()->mHourSize ); 919 //qDebug("KOPrefs::instance()->mHourSize adjusted %d to %d ", old,KOPrefs::instance()->mHourSize );
920 } 920 }
921 921
922 922
923 // update config for children 923 // update config for children
924 mTimeLabels->updateConfig(); 924 mTimeLabels->updateConfig();
925 mAgenda->storePosition(); 925 mAgenda->storePosition();
926 mAgenda->updateConfig(); 926 mAgenda->updateConfig();
927 mAllDayAgenda->updateConfig(); 927 mAllDayAgenda->updateConfig();
928 // widget synchronization 928 // widget synchronization
929 //TODO: find a better way, maybe signal/slot 929 //TODO: find a better way, maybe signal/slot
930 mTimeLabels->positionChanged(); 930 mTimeLabels->positionChanged();
931 931
932 // for some reason, this needs to be called explicitly 932 // for some reason, this needs to be called explicitly
933 mTimeLabels->repaint(); 933 mTimeLabels->repaint();
934 934
935 mDummyAllDayLeft->setFixedWidth(mTimeLabels->width()); 935 mDummyAllDayLeft->setFixedWidth(mTimeLabels->width());
936 936
937 // ToolTips displaying summary of events 937 // ToolTips displaying summary of events
938 KOAgendaItem::toolTipGroup()->setEnabled(KOPrefs::instance() 938 KOAgendaItem::toolTipGroup()->setEnabled(KOPrefs::instance()
939 ->mEnableToolTips); 939 ->mEnableToolTips);
940 940
941 //setHolidayMasks(); 941 //setHolidayMasks();
942 942
943 //createDayLabels(); called by via updateView(); 943 //createDayLabels(); called by via updateView();
944 mEventIndicatorTop->setXOffset(mTimeLabels->width() + mAgenda->frameWidth()); 944 mEventIndicatorTop->setXOffset(mTimeLabels->width() + mAgenda->frameWidth());
945 updateView(); 945 updateView();
946 mAgenda->restorePosition(); 946 mAgenda->restorePosition();
947} 947}
948 948
949 949
950void KOAgendaView::updateEventDates(KOAgendaItem *item, int type) 950void KOAgendaView::updateEventDates(KOAgendaItem *item, int type)
951{ 951{
952 952
953 953
954 int xxx = item->cellX(); 954 int xxx = item->cellX();
955 //qDebug("KOAgendaView::updateEventDates %d %d %d %d %d", xxx, mMinY.at(xxx),mMaxY.at(xxx),item->cellYTop(),item->cellYBottom() ); 955 //qDebug("KOAgendaView::updateEventDates %d %d %d %d %d", xxx, mMinY.at(xxx),mMaxY.at(xxx),item->cellYTop(),item->cellYBottom() );
956 if ( mMinY.at(xxx) > item->cellYTop() ) 956 if ( mMinY.at(xxx) > item->cellYTop() )
957 mMinY.at(xxx) = item->cellYTop(); 957 mMinY.at(xxx) = item->cellYTop();
958 if ( mMaxY.at(xxx) < item->cellYBottom() ) 958 if ( mMaxY.at(xxx) < item->cellYBottom() )
959 mMaxY.at(xxx) = item->cellYBottom(); 959 mMaxY.at(xxx) = item->cellYBottom();
960 960
961 QDateTime startDt,endDt; 961 QDateTime startDt,endDt;
962 QDate startDate; 962 QDate startDate;
963 int lenInSecs; 963 int lenInSecs;
964 // if ( type == KOAgenda::RESIZETOP ) 964 // if ( type == KOAgenda::RESIZETOP )
965 // qDebug("RESIZETOP "); 965 // qDebug("RESIZETOP ");
966 // if ( type == KOAgenda::RESIZEBOTTOM ) 966 // if ( type == KOAgenda::RESIZEBOTTOM )
967 // qDebug("RESIZEBOTTOM "); 967 // qDebug("RESIZEBOTTOM ");
968 // if ( type == KOAgenda::MOVE ) 968 // if ( type == KOAgenda::MOVE )
969 // qDebug("MOVE "); 969 // qDebug("MOVE ");
970 if ( item->incidence()->type() == "Event" ) { 970 if ( item->incidence()->type() == "Event" ) {
971 startDt =item->incidence()->dtStart(); 971 startDt =item->incidence()->dtStart();
972 endDt = item->incidence()->dtEnd(); 972 endDt = item->incidence()->dtEnd();
973 lenInSecs = startDt.secsTo( endDt ); 973 lenInSecs = startDt.secsTo( endDt );
974 } 974 }
975 975
976 // emit incidenceItemChanged( item->incidence(), KOGlobals::EVENTEDITED ); 976 // emit incidenceItemChanged( item->incidence(), KOGlobals::EVENTEDITED );
977 977
978 if ( item->incidence()->type()=="Todo" && item->mLastMoveXPos > 0 ) { 978 if ( item->incidence()->type()=="Todo" && item->mLastMoveXPos > 0 ) {
979 startDate = mSelectedDates[item->mLastMoveXPos]; 979 startDate = mSelectedDates[item->mLastMoveXPos];
980 } else { 980 } else {
981 if (item->cellX() < 0) { 981 if (item->cellX() < 0) {
982 startDate = (mSelectedDates.first()).addDays(item->cellX()); 982 startDate = (mSelectedDates.first()).addDays(item->cellX());
983 } else { 983 } else {
@@ -1103,132 +1103,132 @@ void KOAgendaView::fillAgenda()
1103 //qDebug("fillAgenda()++++ "); 1103 //qDebug("fillAgenda()++++ ");
1104 globalFlagBlockAgendaItemPaint = 1; 1104 globalFlagBlockAgendaItemPaint = 1;
1105 1105
1106 mAllDayAgenda->changeColumns(mSelectedDates.count()); 1106 mAllDayAgenda->changeColumns(mSelectedDates.count());
1107 mAgenda->changeColumns(mSelectedDates.count()); 1107 mAgenda->changeColumns(mSelectedDates.count());
1108 qApp->processEvents(); 1108 qApp->processEvents();
1109 mEventIndicatorTop->changeColumns(mSelectedDates.count()); 1109 mEventIndicatorTop->changeColumns(mSelectedDates.count());
1110 mEventIndicatorBottom->changeColumns(mSelectedDates.count()); 1110 mEventIndicatorBottom->changeColumns(mSelectedDates.count());
1111 setHolidayMasks(); 1111 setHolidayMasks();
1112 1112
1113 //mAgenda->hideUnused(); 1113 //mAgenda->hideUnused();
1114 //mAllDayAgenda->hideUnused(); 1114 //mAllDayAgenda->hideUnused();
1115 1115
1116 // mAgenda->blockNextRepaint( false ); 1116 // mAgenda->blockNextRepaint( false );
1117 // mAgenda->viewport()->repaint(); 1117 // mAgenda->viewport()->repaint();
1118 // mAgenda->blockNextRepaint( true ); 1118 // mAgenda->blockNextRepaint( true );
1119 mMinY.resize(mSelectedDates.count()); 1119 mMinY.resize(mSelectedDates.count());
1120 mMaxY.resize(mSelectedDates.count()); 1120 mMaxY.resize(mSelectedDates.count());
1121 1121
1122 QPtrList<Event> dayEvents; 1122 QPtrList<Event> dayEvents;
1123 1123
1124 // ToDo items shall be displayed for the day they are due, but only showed today if they are already overdue. 1124 // ToDo items shall be displayed for the day they are due, but only showed today if they are already overdue.
1125 // Therefore, gtodoset all of them. 1125 // Therefore, gtodoset all of them.
1126 QPtrList<Todo> todos = calendar()->todos(); 1126 QPtrList<Todo> todos = calendar()->todos();
1127 1127
1128 mAgenda->setDateList(mSelectedDates); 1128 mAgenda->setDateList(mSelectedDates);
1129 1129
1130 QDate today = QDate::currentDate(); 1130 QDate today = QDate::currentDate();
1131 1131
1132 DateList::ConstIterator dit; 1132 DateList::ConstIterator dit;
1133 int curCol = 0; 1133 int curCol = 0;
1134 for( dit = mSelectedDates.begin(); dit != mSelectedDates.end(); ++dit ) { 1134 for( dit = mSelectedDates.begin(); dit != mSelectedDates.end(); ++dit ) {
1135 QDate currentDate = *dit; 1135 QDate currentDate = *dit;
1136 // kdDebug() << "KOAgendaView::fillAgenda(): " << currentDate.toString() 1136 // kdDebug() << "KOAgendaView::fillAgenda(): " << currentDate.toString()
1137 // << endl; 1137 // << endl;
1138 1138
1139 dayEvents = calendar()->events(currentDate,true); 1139 dayEvents = calendar()->events(currentDate,true);
1140 1140
1141 // Default values, which can never be reached 1141 // Default values, which can never be reached
1142 mMinY[curCol] = mAgenda->timeToY(QTime(23,59)) + 1; 1142 mMinY[curCol] = mAgenda->timeToY(QTime(23,59)) + 1;
1143 mMaxY[curCol] = mAgenda->timeToY(QTime(0,0)) - 1; 1143 mMaxY[curCol] = mAgenda->timeToY(QTime(0,0)) - 1;
1144 1144
1145 unsigned int numEvent; 1145 unsigned int numEvent;
1146 for(numEvent=0;numEvent<dayEvents.count();++numEvent) { 1146 for(numEvent=0;numEvent<dayEvents.count();++numEvent) {
1147 Event *event = dayEvents.at(numEvent); 1147 Event *event = dayEvents.at(numEvent);
1148 if ( !KOPrefs::instance()->mShowSyncEvents && event->uid().left(2) == QString("la") ) 1148 if ( !KOPrefs::instance()->mShowSyncEvents && event->uid().left(2) == QString("la") )
1149 if ( event->uid().left(15) == QString("last-syncEvent-") ) 1149 if ( event->uid().left(15) == QString("last-syncEvent-") )
1150 continue; 1150 continue;
1151 // kdDebug() << " Event: " << event->summary() << endl; 1151 // kdDebug() << " Event: " << event->summary() << endl;
1152 1152
1153 int beginX = currentDate.daysTo(event->dtStart().date()) + curCol; 1153 int beginX = currentDate.daysTo(event->dtStart().date()) + curCol;
1154 int endX = currentDate.daysTo(event->dtEnd().date()) + curCol; 1154 int endX = currentDate.daysTo(event->dtEnd().date()) + curCol;
1155 1155
1156 // kdDebug() << " beginX: " << beginX << " endX: " << endX << endl; 1156 // kdDebug() << " beginX: " << beginX << " endX: " << endX << endl;
1157 1157
1158 if (event->doesFloat()) { 1158 if (event->doesFloat()) {
1159 if (event->recurrence()->doesRecur()) { 1159 if (event->recurrence()->doesRecur()) {
1160 if (event->isMultiDay() ) { 1160 if (event->isMultiDay() ) {
1161 endX = endX - beginX;// endX is now number of days 1161 endX = endX - beginX;// endX is now number of days
1162 if ( event->recursOn( currentDate ) ) { 1162 if ( event->recursOn( currentDate ) ) {
1163 endX += curCol; 1163 endX += curCol;
1164 beginX = curCol; 1164 beginX = curCol;
1165 mAllDayAgenda->insertAllDayItem(event,currentDate,beginX,endX); 1165 mAllDayAgenda->insertAllDayItem(event,currentDate,beginX,endX);
1166 } else { 1166 } else {
1167 qDebug("days %d %s",endX , currentDate.toString().latin1()); 1167 //qDebug("days %d %s",endX , currentDate.toString().latin1());
1168 QDate dateit = currentDate.addDays( -endX ); 1168 QDate dateit = currentDate.addDays( -endX );
1169 if ( event->recursOn( dateit ) ) { 1169 if ( event->recursOn( dateit ) ) {
1170 qDebug("found %d %d %d %s", endX,curCol, curCol-endX ,dateit.toString().latin1() ); 1170 //qDebug("found %d %d %d %s", endX,curCol, curCol-endX ,dateit.toString().latin1() );
1171 if ( curCol-endX < 0 ) { 1171 if ( curCol-endX < 0 ) {
1172 mAllDayAgenda->insertAllDayItem(event,currentDate,0,curCol); 1172 mAllDayAgenda->insertAllDayItem(event,currentDate,0,curCol);
1173 } 1173 }
1174 } 1174 }
1175 } 1175 }
1176 } else { 1176 } else {
1177 mAllDayAgenda->insertAllDayItem(event,currentDate,curCol,curCol); 1177 mAllDayAgenda->insertAllDayItem(event,currentDate,curCol,curCol);
1178 } 1178 }
1179 1179
1180 } else { 1180 } else {
1181 if (beginX <= 0 && curCol == 0) { 1181 if (beginX <= 0 && curCol == 0) {
1182 mAllDayAgenda->insertAllDayItem(event,currentDate,beginX,endX); 1182 mAllDayAgenda->insertAllDayItem(event,currentDate,beginX,endX);
1183 } else if (beginX == curCol) { 1183 } else if (beginX == curCol) {
1184 mAllDayAgenda->insertAllDayItem(event,currentDate,beginX,endX); 1184 mAllDayAgenda->insertAllDayItem(event,currentDate,beginX,endX);
1185 } 1185 }
1186 } 1186 }
1187 } else if (event->isMultiDay()) { 1187 } else if (event->isMultiDay()) {
1188 if ( event->doesRecur () ) { 1188 if ( event->doesRecur () ) {
1189 QDate dateit = currentDate; 1189 QDate dateit = currentDate;
1190 int count = 0; 1190 int count = 0;
1191 int max = event->dtStart().daysTo( event->dtEnd() ) +2; 1191 int max = event->dtStart().daysTo( event->dtEnd() ) +2;
1192 while (! event->recursOn( dateit ) && count <= max ) { 1192 while (! event->recursOn( dateit ) && count <= max ) {
1193 ++count; 1193 ++count;
1194 dateit = dateit.addDays( -1 ); 1194 dateit = dateit.addDays( -1 );
1195 } 1195 }
1196 bool ok; 1196 bool ok;
1197 QDateTime nextOcstart = event->getNextOccurence( QDateTime(dateit) ,&ok ); 1197 QDateTime nextOcstart = event->getNextOccurence( QDateTime(dateit) ,&ok );
1198 if ( ok ) 1198 if ( ok )
1199 { 1199 {
1200 int secs = event->dtStart().secsTo( event->dtEnd() ); 1200 int secs = event->dtStart().secsTo( event->dtEnd() );
1201 QDateTime nextOcend =nextOcstart.addSecs( secs ); ; 1201 QDateTime nextOcend =nextOcstart.addSecs( secs ); ;
1202 beginX = currentDate.daysTo(nextOcstart.date()) + curCol; 1202 beginX = currentDate.daysTo(nextOcstart.date()) + curCol;
1203 endX = currentDate.daysTo(nextOcend.date()) + curCol; 1203 endX = currentDate.daysTo(nextOcend.date()) + curCol;
1204 1204
1205 } 1205 }
1206 } 1206 }
1207 int startY = mAgenda->timeToY(event->dtStart().time()); 1207 int startY = mAgenda->timeToY(event->dtStart().time());
1208 int endY = mAgenda->timeToY(event->dtEnd().time()) - 1; 1208 int endY = mAgenda->timeToY(event->dtEnd().time()) - 1;
1209 //qDebug("insert %d %d %d %d %d ",beginX,endX,startY,endY , curCol ); 1209 //qDebug("insert %d %d %d %d %d ",beginX,endX,startY,endY , curCol );
1210 if ((beginX <= 0 && curCol == 0) || beginX == curCol) { 1210 if ((beginX <= 0 && curCol == 0) || beginX == curCol) {
1211 //qDebug("insert!!! "); 1211 //qDebug("insert!!! ");
1212 mAgenda->insertMultiItem(event,currentDate,beginX,endX,startY,endY); 1212 mAgenda->insertMultiItem(event,currentDate,beginX,endX,startY,endY);
1213 } 1213 }
1214 if (beginX == curCol) { 1214 if (beginX == curCol) {
1215 mMaxY[curCol] = mAgenda->timeToY(QTime(23,59)); 1215 mMaxY[curCol] = mAgenda->timeToY(QTime(23,59));
1216 if (startY < mMinY[curCol]) mMinY[curCol] = startY; 1216 if (startY < mMinY[curCol]) mMinY[curCol] = startY;
1217 } else if (endX == curCol) { 1217 } else if (endX == curCol) {
1218 mMinY[curCol] = mAgenda->timeToY(QTime(0,0)); 1218 mMinY[curCol] = mAgenda->timeToY(QTime(0,0));
1219 if (endY > mMaxY[curCol]) mMaxY[curCol] = endY; 1219 if (endY > mMaxY[curCol]) mMaxY[curCol] = endY;
1220 } else { 1220 } else {
1221 mMinY[curCol] = mAgenda->timeToY(QTime(0,0)); 1221 mMinY[curCol] = mAgenda->timeToY(QTime(0,0));
1222 mMaxY[curCol] = mAgenda->timeToY(QTime(23,59)); 1222 mMaxY[curCol] = mAgenda->timeToY(QTime(23,59));
1223 } 1223 }
1224 } else { 1224 } else {
1225 int startY = mAgenda->timeToY(event->dtStart().time()); 1225 int startY = mAgenda->timeToY(event->dtStart().time());
1226 int endY = mAgenda->timeToY(event->dtEnd().time()) - 1; 1226 int endY = mAgenda->timeToY(event->dtEnd().time()) - 1;
1227 if (endY < startY) endY = startY; 1227 if (endY < startY) endY = startY;
1228 mAgenda->insertItem(event,currentDate,curCol,startY,endY); 1228 mAgenda->insertItem(event,currentDate,curCol,startY,endY);
1229 if (startY < mMinY[curCol]) mMinY[curCol] = startY; 1229 if (startY < mMinY[curCol]) mMinY[curCol] = startY;
1230 if (endY > mMaxY[curCol]) mMaxY[curCol] = endY; 1230 if (endY > mMaxY[curCol]) mMaxY[curCol] = endY;
1231 } 1231 }
1232 } 1232 }
1233 // ---------- [display Todos -------------- 1233 // ---------- [display Todos --------------
1234 unsigned int numTodo; 1234 unsigned int numTodo;
diff --git a/korganizer/kodaymatrix.cpp b/korganizer/kodaymatrix.cpp
index ecca374..17a1d13 100644
--- a/korganizer/kodaymatrix.cpp
+++ b/korganizer/kodaymatrix.cpp
@@ -436,129 +436,128 @@ void KODayMatrix::updateViewTimed()
436 break; 436 break;
437 invalid = true; 437 invalid = true;
438 //qDebug("invalid %s", event->summary().latin1()); 438 //qDebug("invalid %s", event->summary().latin1());
439 incidenceStart = QDateTime( mStartDate ).addSecs( -2 );; 439 incidenceStart = QDateTime( mStartDate ).addSecs( -2 );;
440 } 440 }
441 if ( last ) 441 if ( last )
442 break; 442 break;
443 bool ok; 443 bool ok;
444 incidenceStart = event->getNextOccurence( incidenceStart.addSecs( 1 ) ,&ok ); 444 incidenceStart = event->getNextOccurence( incidenceStart.addSecs( 1 ) ,&ok );
445 if ( ! ok ) 445 if ( ! ok )
446 break; 446 break;
447 if ( incidenceStart.date() > endDate ) 447 if ( incidenceStart.date() > endDate )
448 break; 448 break;
449 } 449 }
450 } else { // no recur 450 } else { // no recur
451 int st = event->dtStart().date().daysTo( endDate ); 451 int st = event->dtStart().date().daysTo( endDate );
452 if ( st >= 0 ) { // start before timeend 452 if ( st >= 0 ) { // start before timeend
453 int end = mStartDate.daysTo( event->dtEnd().date() ); 453 int end = mStartDate.daysTo( event->dtEnd().date() );
454 if ( end >= 0 ) { // end after timestart --- got one! 454 if ( end >= 0 ) { // end after timestart --- got one!
455 //normalize 455 //normalize
456 st = timeSpan - st; 456 st = timeSpan - st;
457 if ( st < 0 ) st = 0; 457 if ( st < 0 ) st = 0;
458 if ( end > timeSpan ) end = timeSpan; 458 if ( end > timeSpan ) end = timeSpan;
459 int iii; 459 int iii;
460 for ( iii = st;iii<= end;++iii) 460 for ( iii = st;iii<= end;++iii)
461 computeEvent( event, iii ); 461 computeEvent( event, iii );
462 } 462 }
463 } 463 }
464 } 464 }
465 } 465 }
466 int startDay = days[0].dayOfWeek(); // 1...7 7 = sunday 466 int startDay = days[0].dayOfWeek(); // 1...7 7 = sunday
467 for(i = 0; i < NUMDAYS; i++) { 467 for(i = 0; i < NUMDAYS; i++) {
468 if ( ( (i+startDay) % 7 == 0 ) ) { 468 if ( ( (i+startDay) % 7 == 0 ) ) {
469 pDays.setBit(i); 469 pDays.setBit(i);
470 } 470 }
471 } 471 }
472 472
473#if 0 473#if 0
474 // insert due todos 474 // insert due todos
475 QPtrList<Todo> todos = calendar()->todos( ); 475 QPtrList<Todo> todos = calendar()->todos( );
476 Todo *todo; 476 Todo *todo;
477 for(todo = todos.first(); todo; todo = todos.next()) { 477 for(todo = todos.first(); todo; todo = todos.next()) {
478 //insertTodo( todo ); 478 //insertTodo( todo );
479 if ( todo->hasDueDate() ) { 479 if ( todo->hasDueDate() ) {
480 int day = mStartDate.daysTo( todo->dtDue().date() ); 480 int day = mStartDate.daysTo( todo->dtDue().date() );
481 if ( day >= 0 && day < timeSpan + 1) { 481 if ( day >= 0 && day < timeSpan + 1) {
482 (*cells)[day]->insertTodo( todo ); 482 (*cells)[day]->insertTodo( todo );
483 } 483 }
484 } 484 }
485 } 485 }
486#endif 486#endif
487 487
488#else 488#else
489 //qDebug("KODayMatrix::updateViewTimed "); 489 //qDebug("KODayMatrix::updateViewTimed ");
490 for(int i = 0; i < NUMDAYS; i++) { 490 for(int i = 0; i < NUMDAYS; i++) {
491 // if events are set for the day then remember to draw it bold 491 // if events are set for the day then remember to draw it bold
492 QPtrList<Event> eventlist = mCalendar->events(days[i]); 492 QPtrList<Event> eventlist = mCalendar->events(days[i]);
493 Event *event; 493 Event *event;
494 int numEvents = eventlist.count(); 494 int numEvents = eventlist.count();
495 QString holiStr = ""; 495 QString holiStr = "";
496 bDays.clearBit(i); 496 bDays.clearBit(i);
497 hDays.clearBit(i); 497 hDays.clearBit(i);
498 eDays.clearBit(i); 498 eDays.clearBit(i);
499 for(event=eventlist.first();event != 0;event=eventlist.next()) { 499 for(event=eventlist.first();event != 0;event=eventlist.next()) {
500 qDebug("FFFFFFFFFFFFFFFFFFFFFFFFF ");
501 ushort recurType = event->recurrence()->doesRecur(); 500 ushort recurType = event->recurrence()->doesRecur();
502 if ((recurType == Recurrence::rDaily && !KOPrefs::instance()->mDailyRecur) || 501 if ((recurType == Recurrence::rDaily && !KOPrefs::instance()->mDailyRecur) ||
503 (recurType == Recurrence::rWeekly && !KOPrefs::instance()->mWeeklyRecur)) { 502 (recurType == Recurrence::rWeekly && !KOPrefs::instance()->mWeeklyRecur)) {
504 numEvents--; 503 numEvents--;
505 } 504 }
506 if ( event->isHoliday()) { 505 if ( event->isHoliday()) {
507 hDays.setBit(i); 506 hDays.setBit(i);
508 if ( !holiStr.isEmpty() ) 507 if ( !holiStr.isEmpty() )
509 holiStr += "\n"; 508 holiStr += "\n";
510 holiStr += event->summary(); 509 holiStr += event->summary();
511 if ( !event->location().isEmpty() ) 510 if ( !event->location().isEmpty() )
512 holiStr += " (" + event->location() + ")"; 511 holiStr += " (" + event->location() + ")";
513 } 512 }
514 if ( event->isBirthday()) { 513 if ( event->isBirthday()) {
515 if ( !holiStr.isEmpty() ) 514 if ( !holiStr.isEmpty() )
516 holiStr += "\n"; 515 holiStr += "\n";
517 holiStr += i18n("Birthday") + ": "+event->summary(); 516 holiStr += i18n("Birthday") + ": "+event->summary();
518 if ( !event->location().isEmpty() ) 517 if ( !event->location().isEmpty() )
519 holiStr += " (" + event->location() + ")"; 518 holiStr += " (" + event->location() + ")";
520 bDays.setBit(i); 519 bDays.setBit(i);
521 } 520 }
522 } 521 }
523 if ( numEvents ) 522 if ( numEvents )
524 eDays.setBit(i); 523 eDays.setBit(i);
525 //if it is a holy day then draw it red. Sundays are consider holidays, too 524 //if it is a holy day then draw it red. Sundays are consider holidays, too
526 if ( (KOGlobals::self()->calendarSystem()->dayOfWeek(days[i]) == KOGlobals::self()->calendarSystem()->weekDayOfPray()) || 525 if ( (KOGlobals::self()->calendarSystem()->dayOfWeek(days[i]) == KOGlobals::self()->calendarSystem()->weekDayOfPray()) ||
527 !holiStr.isEmpty()) { 526 !holiStr.isEmpty()) {
528 mHolidays[i] = holiStr; 527 mHolidays[i] = holiStr;
529 } else { 528 } else {
530 mHolidays[i] = QString::null; 529 mHolidays[i] = QString::null;
531 } 530 }
532 } 531 }
533#endif 532#endif
534 mRedrawNeeded = true; 533 mRedrawNeeded = true;
535 if ( ! mPendingUpdateBeforeRepaint ) 534 if ( ! mPendingUpdateBeforeRepaint )
536 repaint(false); 535 repaint(false);
537} 536}
538void KODayMatrix::updateView(QDate actdate) 537void KODayMatrix::updateView(QDate actdate)
539{ 538{
540 539
541 if ( ! actdate.isValid() ) { 540 if ( ! actdate.isValid() ) {
542 //qDebug("date not valid "); 541 //qDebug("date not valid ");
543 return; 542 return;
544 } 543 }
545 mDayChanged = false; 544 mDayChanged = false;
546 //flag to indicate if the starting day of the matrix has changed by this call 545 //flag to indicate if the starting day of the matrix has changed by this call
547 //mDayChanged = false; 546 //mDayChanged = false;
548 // if a new startdate is to be set then apply Cornelius's calculation 547 // if a new startdate is to be set then apply Cornelius's calculation
549 // of the first day to be shown 548 // of the first day to be shown
550 if (actdate != startdate) { 549 if (actdate != startdate) {
551 // reset index of selection according to shift of starting date from startdate to actdate 550 // reset index of selection according to shift of starting date from startdate to actdate
552 if (mSelStart != NOSELECTION) { 551 if (mSelStart != NOSELECTION) {
553 int tmp = actdate.daysTo(startdate); 552 int tmp = actdate.daysTo(startdate);
554 //kdDebug() << "Shift of Selection1: " << mSelStart << " - " << mSelEnd << " -> " << tmp << "(" << offset << ")" << endl; 553 //kdDebug() << "Shift of Selection1: " << mSelStart << " - " << mSelEnd << " -> " << tmp << "(" << offset << ")" << endl;
555 // shift selection if new one would be visible at least partly ! 554 // shift selection if new one would be visible at least partly !
556 555
557 if (mSelStart+tmp < NUMDAYS && mSelEnd+tmp >= 0) { 556 if (mSelStart+tmp < NUMDAYS && mSelEnd+tmp >= 0) {
558 // nested if is required for next X display pushed from a different month - correction required 557 // nested if is required for next X display pushed from a different month - correction required
559 // otherwise, for month forward and backward, it must be avoided 558 // otherwise, for month forward and backward, it must be avoided
560 if( mSelStart > NUMDAYS || mSelStart < 0 ) 559 if( mSelStart > NUMDAYS || mSelStart < 0 )
561 mSelStart = mSelStart + tmp; 560 mSelStart = mSelStart + tmp;
562 if( mSelEnd > NUMDAYS || mSelEnd < 0 ) 561 if( mSelEnd > NUMDAYS || mSelEnd < 0 )
563 mSelEnd = mSelEnd + tmp; 562 mSelEnd = mSelEnd + tmp;
564 } 563 }
diff --git a/korganizer/koeditorgeneral.cpp b/korganizer/koeditorgeneral.cpp
index 9df76e7..0045b7f 100644
--- a/korganizer/koeditorgeneral.cpp
+++ b/korganizer/koeditorgeneral.cpp
@@ -171,129 +171,129 @@ void KOEditorGeneral::initDescription(QWidget *parent,QBoxLayout *topLayout)
171 topLayout->addWidget(mDescriptionEdit); 171 topLayout->addWidget(mDescriptionEdit);
172#ifndef DESKTOP_VERSION 172#ifndef DESKTOP_VERSION
173 QPEApplication::setStylusOperation( mDescriptionEdit, QPEApplication::RightOnHold ); 173 QPEApplication::setStylusOperation( mDescriptionEdit, QPEApplication::RightOnHold );
174#endif 174#endif
175 175
176} 176}
177 177
178void KOEditorGeneral::initAlarm(QWidget *parent,QBoxLayout *topLayout) 178void KOEditorGeneral::initAlarm(QWidget *parent,QBoxLayout *topLayout)
179{ 179{
180 QBoxLayout *alarmLayout = new QHBoxLayout(topLayout); 180 QBoxLayout *alarmLayout = new QHBoxLayout(topLayout);
181 181
182 //mAlarmBell = new QLabel(parent); 182 //mAlarmBell = new QLabel(parent);
183 //mAlarmBell->setPixmap(SmallIcon("bell")); 183 //mAlarmBell->setPixmap(SmallIcon("bell"));
184 //alarmLayout->addWidget(mAlarmBell); 184 //alarmLayout->addWidget(mAlarmBell);
185 if ( QApplication::desktop()->width() < 320 ) 185 if ( QApplication::desktop()->width() < 320 )
186 mAlarmButton = new QCheckBox(i18n("Rem."),parent); 186 mAlarmButton = new QCheckBox(i18n("Rem."),parent);
187 else 187 else
188 mAlarmButton = new QCheckBox(i18n("Reminder:"),parent); 188 mAlarmButton = new QCheckBox(i18n("Reminder:"),parent);
189 189
190 connect(mAlarmButton, SIGNAL(toggled(bool)), SLOT(enableAlarmEdit(bool))); 190 connect(mAlarmButton, SIGNAL(toggled(bool)), SLOT(enableAlarmEdit(bool)));
191 alarmLayout->addWidget(mAlarmButton); 191 alarmLayout->addWidget(mAlarmButton);
192 192
193 mAlarmTimeEdit = new QSpinBox ( 0, 9999, 1, parent, "mAlarmTimeEdit " ) ; 193 mAlarmTimeEdit = new QSpinBox ( 0, 9999, 1, parent, "mAlarmTimeEdit " ) ;
194 mAlarmTimeEdit->setButtonSymbols( QSpinBox::PlusMinus ); 194 mAlarmTimeEdit->setButtonSymbols( QSpinBox::PlusMinus );
195 alarmLayout->addWidget(mAlarmTimeEdit); 195 alarmLayout->addWidget(mAlarmTimeEdit);
196 mAlarmIncrCombo = new QComboBox(false, parent); 196 mAlarmIncrCombo = new QComboBox(false, parent);
197 if ( QApplication::desktop()->width() < 320 ) { 197 if ( QApplication::desktop()->width() < 320 ) {
198 mAlarmIncrCombo->insertItem(i18n("min")); 198 mAlarmIncrCombo->insertItem(i18n("min"));
199 mAlarmIncrCombo->insertItem(i18n("hou")); 199 mAlarmIncrCombo->insertItem(i18n("hou"));
200 mAlarmIncrCombo->insertItem(i18n("day")); 200 mAlarmIncrCombo->insertItem(i18n("day"));
201 mAlarmTimeEdit->setMaximumWidth( mAlarmTimeEdit->sizeHint().width() ); 201 mAlarmTimeEdit->setMaximumWidth( mAlarmTimeEdit->sizeHint().width() );
202 mAlarmIncrCombo->setMaximumWidth( mAlarmIncrCombo->sizeHint().width() ); 202 mAlarmIncrCombo->setMaximumWidth( mAlarmIncrCombo->sizeHint().width() );
203 } else { 203 } else {
204 mAlarmIncrCombo->insertItem(i18n("minute(s)")); 204 mAlarmIncrCombo->insertItem(i18n("minute(s)"));
205 mAlarmIncrCombo->insertItem(i18n("hour(s)")); 205 mAlarmIncrCombo->insertItem(i18n("hour(s)"));
206 mAlarmIncrCombo->insertItem(i18n("day(s)")); 206 mAlarmIncrCombo->insertItem(i18n("day(s)"));
207 } 207 }
208 208
209 // mAlarmIncrCombo->setMinimumHeight(20); 209 // mAlarmIncrCombo->setMinimumHeight(20);
210 alarmLayout->addWidget(mAlarmIncrCombo); 210 alarmLayout->addWidget(mAlarmIncrCombo);
211 mAlarmSoundButton = new QPushButton(parent); 211 mAlarmSoundButton = new QPushButton(parent);
212 mAlarmSoundButton->setPixmap(SmallIcon("playsound")); 212 mAlarmSoundButton->setPixmap(SmallIcon("playsound"));
213 mAlarmSoundButton->setToggleButton(true); 213 mAlarmSoundButton->setToggleButton(true);
214 QToolTip::add(mAlarmSoundButton, i18n("No sound set")); 214 QToolTip::add(mAlarmSoundButton, i18n("No sound set"));
215 connect(mAlarmSoundButton, SIGNAL(clicked()), SLOT(pickAlarmSound())); 215 connect(mAlarmSoundButton, SIGNAL(clicked()), SLOT(pickAlarmSound()));
216 alarmLayout->addWidget(mAlarmSoundButton); 216 alarmLayout->addWidget(mAlarmSoundButton);
217 217
218 mAlarmProgramButton = new QPushButton(parent); 218 mAlarmProgramButton = new QPushButton(parent);
219 mAlarmProgramButton->setPixmap(SmallIcon("run")); 219 mAlarmProgramButton->setPixmap(SmallIcon("run"));
220 mAlarmProgramButton->setToggleButton(true); 220 mAlarmProgramButton->setToggleButton(true);
221 QToolTip::add(mAlarmProgramButton, i18n("No program set")); 221 QToolTip::add(mAlarmProgramButton, i18n("No program set"));
222 connect(mAlarmProgramButton, SIGNAL(clicked()), SLOT(pickAlarmProgram())); 222 connect(mAlarmProgramButton, SIGNAL(clicked()), SLOT(pickAlarmProgram()));
223 alarmLayout->addWidget(mAlarmProgramButton); 223 alarmLayout->addWidget(mAlarmProgramButton);
224 mAlarmSoundButton->setMaximumWidth( mAlarmSoundButton->sizeHint().width() + 4 ); 224 mAlarmSoundButton->setMaximumWidth( mAlarmSoundButton->sizeHint().width() + 4 );
225 mAlarmProgramButton->setMaximumWidth(mAlarmProgramButton->sizeHint().width() + 4 ); 225 mAlarmProgramButton->setMaximumWidth(mAlarmProgramButton->sizeHint().width() + 4 );
226 // if ( KOPrefs::instance()->mCompactDialogs ) { 226 // if ( KOPrefs::instance()->mCompactDialogs ) {
227 // mAlarmSoundButton->hide(); 227 // mAlarmSoundButton->hide();
228 // mAlarmProgramButton->hide(); 228 // mAlarmProgramButton->hide();
229 // } 229 // }
230} 230}
231 231
232void KOEditorGeneral::pickAlarmSound() 232void KOEditorGeneral::pickAlarmSound()
233{ 233{
234 234
235 qDebug("KOEditorGeneral::pickAlarmSound() %d",mAlarmSoundButton->isOn() ); 235 //qDebug("KOEditorGeneral::pickAlarmSound() %d",mAlarmSoundButton->isOn() );
236 236
237 bool oldState = mAlarmSoundButton->isOn(); 237 bool oldState = mAlarmSoundButton->isOn();
238 238
239 QString fileName(KFileDialog::getOpenFileName(mAlarmSound, 239 QString fileName(KFileDialog::getOpenFileName(mAlarmSound,
240 i18n("*.wav|Wav Files"), 0)); 240 i18n("*.wav|Wav Files"), 0));
241 if (!fileName.isEmpty()) { 241 if (!fileName.isEmpty()) {
242 mAlarmSound = fileName; 242 mAlarmSound = fileName;
243 QToolTip::remove(mAlarmSoundButton); 243 QToolTip::remove(mAlarmSoundButton);
244 QString dispStr = i18n("Playing '%1'").arg(fileName); 244 QString dispStr = i18n("Playing '%1'").arg(fileName);
245 QToolTip::add(mAlarmSoundButton, dispStr); 245 QToolTip::add(mAlarmSoundButton, dispStr);
246 mAlarmProgramButton->setOn(false); 246 mAlarmProgramButton->setOn(false);
247 mAlarmSoundButton->setOn(true); 247 mAlarmSoundButton->setOn(true);
248 QToolTip::add(mAlarmProgramButton, i18n("No program set")); 248 QToolTip::add(mAlarmProgramButton, i18n("No program set"));
249 } else { 249 } else {
250 mAlarmProgramButton->setOn(oldState); 250 mAlarmProgramButton->setOn(oldState);
251 mAlarmSoundButton->setOn(!oldState); 251 mAlarmSoundButton->setOn(!oldState);
252 252
253 253
254 } 254 }
255 255
256 if (mAlarmProgramButton->isOn()) 256 if (mAlarmProgramButton->isOn())
257 ((QWidget*)parent())->topLevelWidget()->setCaption(i18n("Proc.Al.: ") + getFittingPath(mAlarmProgram) ); 257 ((QWidget*)parent())->topLevelWidget()->setCaption(i18n("Proc.Al.: ") + getFittingPath(mAlarmProgram) );
258 if ( mAlarmSoundButton->isOn()) 258 if ( mAlarmSoundButton->isOn())
259 ((QWidget*)parent())->topLevelWidget()->setCaption(i18n("Audio Al.: ") + getFittingPath(mAlarmSound) ); 259 ((QWidget*)parent())->topLevelWidget()->setCaption(i18n("Audio Al.: ") + getFittingPath(mAlarmSound) );
260 260
261} 261}
262 262
263void KOEditorGeneral::pickAlarmProgram() 263void KOEditorGeneral::pickAlarmProgram()
264{ 264{
265 bool oldState = mAlarmProgramButton->isOn(); 265 bool oldState = mAlarmProgramButton->isOn();
266 266
267 QString fileName(KFileDialog::getOpenFileName(mAlarmProgram,i18n("Procedure Alarm: ") , 0)); 267 QString fileName(KFileDialog::getOpenFileName(mAlarmProgram,i18n("Procedure Alarm: ") , 0));
268 if (!fileName.isEmpty()) { 268 if (!fileName.isEmpty()) {
269 mAlarmProgram = fileName; 269 mAlarmProgram = fileName;
270 QToolTip::remove(mAlarmProgramButton); 270 QToolTip::remove(mAlarmProgramButton);
271 QString dispStr = i18n("Running '%1'").arg(fileName); 271 QString dispStr = i18n("Running '%1'").arg(fileName);
272 QToolTip::add(mAlarmProgramButton, dispStr); 272 QToolTip::add(mAlarmProgramButton, dispStr);
273 mAlarmSoundButton->setOn(false); 273 mAlarmSoundButton->setOn(false);
274 mAlarmProgramButton->setOn(true); 274 mAlarmProgramButton->setOn(true);
275 QToolTip::add(mAlarmSoundButton, i18n("No sound set")); 275 QToolTip::add(mAlarmSoundButton, i18n("No sound set"));
276 } else { 276 } else {
277 mAlarmProgramButton->setOn(!oldState); 277 mAlarmProgramButton->setOn(!oldState);
278 mAlarmSoundButton->setOn(oldState); 278 mAlarmSoundButton->setOn(oldState);
279 } 279 }
280 280
281 if (mAlarmProgramButton->isOn()) 281 if (mAlarmProgramButton->isOn())
282 ((QWidget*)parent())->topLevelWidget()->setCaption(i18n("Proc.Al.: ") + getFittingPath(mAlarmProgram) ); 282 ((QWidget*)parent())->topLevelWidget()->setCaption(i18n("Proc.Al.: ") + getFittingPath(mAlarmProgram) );
283 if ( mAlarmSoundButton->isOn()) 283 if ( mAlarmSoundButton->isOn())
284 ((QWidget*)parent())->topLevelWidget()->setCaption(i18n("Audio Al.: ") + getFittingPath(mAlarmSound) ); 284 ((QWidget*)parent())->topLevelWidget()->setCaption(i18n("Audio Al.: ") + getFittingPath(mAlarmSound) );
285 285
286} 286}
287 287
288 288
289QString KOEditorGeneral::getFittingPath( const QString s ) 289QString KOEditorGeneral::getFittingPath( const QString s )
290{ 290{
291 int maxlen = 50; 291 int maxlen = 50;
292 if ( QApplication::desktop()->width() < 640 ) { 292 if ( QApplication::desktop()->width() < 640 ) {
293 if ( QApplication::desktop()->width() < 320 ) 293 if ( QApplication::desktop()->width() < 320 )
294 maxlen = 22; 294 maxlen = 22;
295 else 295 else
296 maxlen = 35; 296 maxlen = 35;
297 } 297 }
298 if ( s.length() > maxlen ) { 298 if ( s.length() > maxlen ) {
299 return "..."+s.right(maxlen -3); 299 return "..."+s.right(maxlen -3);
diff --git a/korganizer/koeditorrecurrence.cpp b/korganizer/koeditorrecurrence.cpp
index 01c5773..47e73dd 100644
--- a/korganizer/koeditorrecurrence.cpp
+++ b/korganizer/koeditorrecurrence.cpp
@@ -878,231 +878,231 @@ void KOEditorRecurrence::readEvent(Incidence *event)
878 878
879 setDefaults( event->dtStart(), dtEnd, true ); 879 setDefaults( event->dtStart(), dtEnd, true );
880 QBitArray rDays( 7 ); 880 QBitArray rDays( 7 );
881 QPtrList<Recurrence::rMonthPos> rmp; 881 QPtrList<Recurrence::rMonthPos> rmp;
882 QPtrList<int> rmd; 882 QPtrList<int> rmd;
883 int day = 0; 883 int day = 0;
884 int count = 0; 884 int count = 0;
885 int month = 0; 885 int month = 0;
886 setDateTimes( event->dtStart(), dtEnd ); 886 setDateTimes( event->dtStart(), dtEnd );
887 887
888 Recurrence *r = event->recurrence(); 888 Recurrence *r = event->recurrence();
889 int f = r->frequency(); 889 int f = r->frequency();
890 890
891 int recurs = r->doesRecur(); 891 int recurs = r->doesRecur();
892 892
893 mEnabledCheck->setChecked( recurs ); 893 mEnabledCheck->setChecked( recurs );
894 setEnabled( recurs ); 894 setEnabled( recurs );
895 895
896 int recurrenceType = RecurrenceChooser::Weekly; 896 int recurrenceType = RecurrenceChooser::Weekly;
897 897
898 switch ( recurs ) { 898 switch ( recurs ) {
899 case Recurrence::rNone: 899 case Recurrence::rNone:
900 setDefaults( event->dtStart(), dtEnd, true ); 900 setDefaults( event->dtStart(), dtEnd, true );
901 break; 901 break;
902 case Recurrence::rDaily: 902 case Recurrence::rDaily:
903 recurrenceType = RecurrenceChooser::Daily; 903 recurrenceType = RecurrenceChooser::Daily;
904 mDaily->setFrequency( f ); 904 mDaily->setFrequency( f );
905 break; 905 break;
906 case Recurrence::rWeekly: 906 case Recurrence::rWeekly:
907 recurrenceType = RecurrenceChooser::Weekly; 907 recurrenceType = RecurrenceChooser::Weekly;
908 mWeekly->setFrequency( f ); 908 mWeekly->setFrequency( f );
909 mWeekly->setDays( r->days() ); 909 mWeekly->setDays( r->days() );
910 break; 910 break;
911 case Recurrence::rMonthlyPos: 911 case Recurrence::rMonthlyPos:
912 // we only handle one possibility in the list right now, 912 // we only handle one possibility in the list right now,
913 // so I have hardcoded calls with first(). If we make the GUI 913 // so I have hardcoded calls with first(). If we make the GUI
914 // more extended, this can be changed. 914 // more extended, this can be changed.
915 recurrenceType = RecurrenceChooser::Monthly; 915 recurrenceType = RecurrenceChooser::Monthly;
916 916
917 rmp = r->monthPositions(); 917 rmp = r->monthPositions();
918 if ( rmp.first()->negative ) 918 if ( rmp.first()->negative )
919 count = 5 - rmp.first()->rPos - 1; 919 count = 5 - rmp.first()->rPos - 1;
920 else 920 else
921 count = rmp.first()->rPos - 1; 921 count = rmp.first()->rPos - 1;
922 day = 0; 922 day = 0;
923 while ( !rmp.first()->rDays.testBit( day ) ) ++day; 923 while ( !rmp.first()->rDays.testBit( day ) ) ++day;
924 mMonthly->setByPos( count, day ); 924 mMonthly->setByPos( count, day );
925 925
926 mMonthly->setFrequency( f ); 926 mMonthly->setFrequency( f );
927 927
928 break; 928 break;
929 case Recurrence::rMonthlyDay: 929 case Recurrence::rMonthlyDay:
930 recurrenceType = RecurrenceChooser::Monthly; 930 recurrenceType = RecurrenceChooser::Monthly;
931 931
932 rmd = r->monthDays(); 932 rmd = r->monthDays();
933 day = *rmd.first() - 1; 933 day = *rmd.first() - 1;
934 mMonthly->setByDay( day ); 934 mMonthly->setByDay( day );
935 935
936 mMonthly->setFrequency( f ); 936 mMonthly->setFrequency( f );
937 937
938 break; 938 break;
939 case Recurrence::rYearlyMonth: 939 case Recurrence::rYearlyMonth:
940 { 940 {
941 recurrenceType = RecurrenceChooser::Yearly; 941 recurrenceType = RecurrenceChooser::Yearly;
942 qDebug("Recurrence::rYearlyMonth: "); 942 //qDebug("Recurrence::rYearlyMonth: ");
943 day = event->dtStart().date().day(); 943 day = event->dtStart().date().day();
944 rmd = r->yearNums(); 944 rmd = r->yearNums();
945 if ( rmd.count() > 0 ) 945 if ( rmd.count() > 0 )
946 month = *rmd.first(); 946 month = *rmd.first();
947 else 947 else
948 month = event->dtStart().date().month() ; 948 month = event->dtStart().date().month() ;
949 mYearly->setByMonth( month, day ); 949 mYearly->setByMonth( month, day );
950#if 0 950#if 0
951 qDebug("2day = %d ",day ); 951 //qDebug("2day = %d ",day );
952 QPtrList<Recurrence::rMonthPos> monthlist = r->yearMonthPositions(); 952 QPtrList<Recurrence::rMonthPos> monthlist = r->yearMonthPositions();
953 int month; 953 int month;
954 if ( !monthlist.isEmpty() ) { 954 if ( !monthlist.isEmpty() ) {
955 month = monthlist.first()->rPos ; 955 month = monthlist.first()->rPos ;
956 } else { 956 } else {
957 month = event->dtStart().date().month() ; 957 month = event->dtStart().date().month() ;
958 } 958 }
959 mYearly->setByMonth( day, month ); 959 mYearly->setByMonth( day, month );
960#endif 960#endif
961 mYearly->setFrequency( f ); 961 mYearly->setFrequency( f );
962 } 962 }
963 963
964 break; 964 break;
965 case Recurrence::rYearlyDay: 965 case Recurrence::rYearlyDay:
966 qDebug("Recurrence::rYearlyDay: "); 966 //qDebug("Recurrence::rYearlyDay: ");
967 recurrenceType = RecurrenceChooser::Yearly; 967 recurrenceType = RecurrenceChooser::Yearly;
968 mYearly->setByDay( event->dtStart().date().dayOfYear() ); 968 mYearly->setByDay( event->dtStart().date().dayOfYear() );
969 mYearly->setFrequency( f ); 969 mYearly->setFrequency( f );
970 break; 970 break;
971 default: 971 default:
972 setDefaults( event->dtStart(), dtEnd, true ); 972 setDefaults( event->dtStart(), dtEnd, true );
973 break; 973 break;
974 } 974 }
975 975
976 mRecurrenceChooser->setType( recurrenceType ); 976 mRecurrenceChooser->setType( recurrenceType );
977 showCurrentRule( recurrenceType ); 977 showCurrentRule( recurrenceType );
978 978
979 mRecurrenceRange->setDateTimes( event->dtStart() ); 979 mRecurrenceRange->setDateTimes( event->dtStart() );
980 980
981 if ( r->doesRecur() ) { 981 if ( r->doesRecur() ) {
982 mRecurrenceRange->setDuration( r->duration() ); 982 mRecurrenceRange->setDuration( r->duration() );
983 if ( r->duration() == 0 ) 983 if ( r->duration() == 0 )
984 { 984 {
985 if ( r->endDate() < event->dtStart().date() ) 985 if ( r->endDate() < event->dtStart().date() )
986 mRecurrenceRange->setEndDate( event->dtStart().date() ); 986 mRecurrenceRange->setEndDate( event->dtStart().date() );
987 else 987 else
988 mRecurrenceRange->setEndDate( r->endDate() ); 988 mRecurrenceRange->setEndDate( r->endDate() );
989 } else 989 } else
990 mRecurrenceRange->setEndDate( event->dtStart().date() ); 990 mRecurrenceRange->setEndDate( event->dtStart().date() );
991 } 991 }
992 992
993 mExceptions->setDates( event->exDates() ); 993 mExceptions->setDates( event->exDates() );
994} 994}
995 995
996void KOEditorRecurrence::writeEvent( Incidence *event ) 996void KOEditorRecurrence::writeEvent( Incidence *event )
997{ 997{
998 Recurrence *r = event->recurrence(); 998 Recurrence *r = event->recurrence();
999 999
1000 // clear out any old settings; 1000 // clear out any old settings;
1001 r->unsetRecurs(); 1001 r->unsetRecurs();
1002 1002
1003 if ( mEnabledCheck->isChecked() ) { 1003 if ( mEnabledCheck->isChecked() ) {
1004 int duration = mRecurrenceRange->duration(); 1004 int duration = mRecurrenceRange->duration();
1005 QDate endDate; 1005 QDate endDate;
1006 if ( duration == 0 ) endDate = mRecurrenceRange->endDate(); 1006 if ( duration == 0 ) endDate = mRecurrenceRange->endDate();
1007 1007
1008 int recurrenceType = mRecurrenceChooser->type(); 1008 int recurrenceType = mRecurrenceChooser->type();
1009 1009
1010 if ( recurrenceType == RecurrenceChooser::Daily ) { 1010 if ( recurrenceType == RecurrenceChooser::Daily ) {
1011 int freq = mDaily->frequency(); 1011 int freq = mDaily->frequency();
1012 if ( duration != 0 ) r->setDaily( freq, duration ); 1012 if ( duration != 0 ) r->setDaily( freq, duration );
1013 else r->setDaily( freq, endDate ); 1013 else r->setDaily( freq, endDate );
1014 } else if ( recurrenceType == RecurrenceChooser::Weekly ) { 1014 } else if ( recurrenceType == RecurrenceChooser::Weekly ) {
1015 int freq = mWeekly->frequency(); 1015 int freq = mWeekly->frequency();
1016 QBitArray days = mWeekly->days(); 1016 QBitArray days = mWeekly->days();
1017 int j; 1017 int j;
1018 bool found = false; 1018 bool found = false;
1019 for (j = 0; j < 7 ; ++j ) { 1019 for (j = 0; j < 7 ; ++j ) {
1020 found |=days.at(j); 1020 found |=days.at(j);
1021 } 1021 }
1022 if ( !found ) { 1022 if ( !found ) {
1023 days.setBit( event->dtStart().date().dayOfWeek()-1); 1023 days.setBit( event->dtStart().date().dayOfWeek()-1);
1024 qDebug("bit set %d ", event->dtStart().date().dayOfWeek()-1); 1024 //qDebug("bit set %d ", event->dtStart().date().dayOfWeek()-1);
1025 } 1025 }
1026 if ( duration != 0 ) r->setWeekly( freq, days, duration ); 1026 if ( duration != 0 ) r->setWeekly( freq, days, duration );
1027 else r->setWeekly( freq, days, endDate ); 1027 else r->setWeekly( freq, days, endDate );
1028 } else if ( recurrenceType == RecurrenceChooser::Monthly ) { 1028 } else if ( recurrenceType == RecurrenceChooser::Monthly ) {
1029 int freq = mMonthly->frequency(); 1029 int freq = mMonthly->frequency();
1030 if ( mMonthly->byPos() ) { 1030 if ( mMonthly->byPos() ) {
1031 int pos = mMonthly->count(); 1031 int pos = mMonthly->count();
1032 1032
1033 QBitArray days( 7 ); 1033 QBitArray days( 7 );
1034 days.fill( false ); 1034 days.fill( false );
1035 1035
1036 days.setBit( mMonthly->weekday() ); 1036 days.setBit( mMonthly->weekday() );
1037 if ( duration != 0 ) 1037 if ( duration != 0 )
1038 r->setMonthly( Recurrence::rMonthlyPos, freq, duration ); 1038 r->setMonthly( Recurrence::rMonthlyPos, freq, duration );
1039 else 1039 else
1040 r->setMonthly( Recurrence::rMonthlyPos, freq, endDate ); 1040 r->setMonthly( Recurrence::rMonthlyPos, freq, endDate );
1041 r->addMonthlyPos( pos, days ); 1041 r->addMonthlyPos( pos, days );
1042 } else { 1042 } else {
1043 // it's by day 1043 // it's by day
1044 int day = mMonthly->day(); 1044 int day = mMonthly->day();
1045 1045
1046 if ( duration != 0 ) { 1046 if ( duration != 0 ) {
1047 r->setMonthly( Recurrence::rMonthlyDay, freq, duration ); 1047 r->setMonthly( Recurrence::rMonthlyDay, freq, duration );
1048 } else { 1048 } else {
1049 r->setMonthly( Recurrence::rMonthlyDay, freq, endDate ); 1049 r->setMonthly( Recurrence::rMonthlyDay, freq, endDate );
1050 } 1050 }
1051 r->addMonthlyDay( day ); 1051 r->addMonthlyDay( day );
1052 } 1052 }
1053 } else if ( recurrenceType == RecurrenceChooser::Yearly ) { 1053 } else if ( recurrenceType == RecurrenceChooser::Yearly ) {
1054 qDebug("RecurrenceChooser::Yearly "); 1054 //qDebug("RecurrenceChooser::Yearly ");
1055 int freq = mYearly->frequency(); 1055 int freq = mYearly->frequency();
1056 if ( mYearly->byDay() ) { 1056 if ( mYearly->byDay() ) {
1057 if ( duration != 0 ) { 1057 if ( duration != 0 ) {
1058 r->setYearly( Recurrence::rYearlyDay, freq, duration ); 1058 r->setYearly( Recurrence::rYearlyDay, freq, duration );
1059 } else { 1059 } else {
1060 r->setYearly( Recurrence::rYearlyDay, freq, endDate ); 1060 r->setYearly( Recurrence::rYearlyDay, freq, endDate );
1061 } 1061 }
1062 r->addYearlyNum( event->dtStart().date().dayOfYear() ); 1062 r->addYearlyNum( event->dtStart().date().dayOfYear() );
1063 } else { 1063 } else {
1064 if ( duration != 0 ) { 1064 if ( duration != 0 ) {
1065 r->setYearly( Recurrence::rYearlyMonth, freq, duration ); 1065 r->setYearly( Recurrence::rYearlyMonth, freq, duration );
1066 } else { 1066 } else {
1067 r->setYearly( Recurrence::rYearlyMonth, freq, endDate ); 1067 r->setYearly( Recurrence::rYearlyMonth, freq, endDate );
1068 } 1068 }
1069 r->addYearlyNum( mYearly->month() ); 1069 r->addYearlyNum( mYearly->month() );
1070 } 1070 }
1071 1071
1072 } 1072 }
1073 1073
1074 event->setExDates( mExceptions->dates() ); 1074 event->setExDates( mExceptions->dates() );
1075 } 1075 }
1076} 1076}
1077 1077
1078void KOEditorRecurrence::setDateTimeStr( const QString &str ) 1078void KOEditorRecurrence::setDateTimeStr( const QString &str )
1079{ 1079{
1080 mDateTimeLabel->setText( str ); 1080 mDateTimeLabel->setText( str );
1081} 1081}
1082 1082
1083bool KOEditorRecurrence::validateInput() 1083bool KOEditorRecurrence::validateInput()
1084{ 1084{
1085 // Check input here 1085 // Check input here
1086 1086
1087 return true; 1087 return true;
1088} 1088}
1089 1089
1090void KOEditorRecurrence::showExceptionsDialog() 1090void KOEditorRecurrence::showExceptionsDialog()
1091{ 1091{
1092 DateList dates = mExceptions->dates(); 1092 DateList dates = mExceptions->dates();
1093 int result = mExceptionsDialog->exec(); 1093 int result = mExceptionsDialog->exec();
1094 if ( result == QDialog::Rejected ) mExceptions->setDates( dates ); 1094 if ( result == QDialog::Rejected ) mExceptions->setDates( dates );
1095} 1095}
1096 1096
1097void KOEditorRecurrence::showRecurrenceRangeDialog() 1097void KOEditorRecurrence::showRecurrenceRangeDialog()
1098{ 1098{
1099 int duration = mRecurrenceRange->duration(); 1099 int duration = mRecurrenceRange->duration();
1100 QDate endDate = mRecurrenceRange->endDate(); 1100 QDate endDate = mRecurrenceRange->endDate();
1101 1101
1102 int result = mRecurrenceRangeDialog->exec(); 1102 int result = mRecurrenceRangeDialog->exec();
1103 if ( result == QDialog::Rejected ) { 1103 if ( result == QDialog::Rejected ) {
1104 mRecurrenceRange->setDuration( duration ); 1104 mRecurrenceRange->setDuration( duration );
1105 mRecurrenceRange->setEndDate( endDate ); 1105 mRecurrenceRange->setEndDate( endDate );
1106 } 1106 }
1107 1107
1108} 1108}
diff --git a/korganizer/koeventviewer.cpp b/korganizer/koeventviewer.cpp
index fefc778..f39b5e1 100644
--- a/korganizer/koeventviewer.cpp
+++ b/korganizer/koeventviewer.cpp
@@ -38,201 +38,197 @@
38#include <kabc/stdaddressbook.h> 38#include <kabc/stdaddressbook.h>
39 39
40#ifndef KORG_NODCOP 40#ifndef KORG_NODCOP
41#include <dcopclient.h> 41#include <dcopclient.h>
42#include "korganizer.h" 42#include "korganizer.h"
43#include "koprefs.h" 43#include "koprefs.h"
44#include "actionmanager.h" 44#include "actionmanager.h"
45#endif 45#endif
46 46
47#include "koeventviewer.h" 47#include "koeventviewer.h"
48//#ifndef KORG_NOKABC 48//#ifndef KORG_NOKABC
49//#include <kabc/stdaddressbook.h> 49//#include <kabc/stdaddressbook.h>
50//#define size count 50//#define size count
51//#endif 51//#endif
52 52
53#ifdef DESKTOP_VERSION 53#ifdef DESKTOP_VERSION
54#include <kabc/addresseedialog.h> 54#include <kabc/addresseedialog.h>
55#include <kabc/addresseeview.h> 55#include <kabc/addresseeview.h>
56#include <qprinter.h> 56#include <qprinter.h>
57#include <qpainter.h> 57#include <qpainter.h>
58#include <qpaintdevicemetrics.h> 58#include <qpaintdevicemetrics.h>
59#else //DESKTOP_VERSION 59#else //DESKTOP_VERSION
60#include <externalapphandler.h> 60#include <externalapphandler.h>
61#include <qtopia/qcopenvelope_qws.h> 61#include <qtopia/qcopenvelope_qws.h>
62#endif //DESKTOP_VERSION 62#endif //DESKTOP_VERSION
63 63
64KOEventViewer::KOEventViewer(QWidget *parent,const char *name) 64KOEventViewer::KOEventViewer(QWidget *parent,const char *name)
65 : QTextBrowser(parent,name) 65 : QTextBrowser(parent,name)
66{ 66{
67 mSyncMode = false; 67 mSyncMode = false;
68 mColorMode = 0; 68 mColorMode = 0;
69} 69}
70 70
71KOEventViewer::~KOEventViewer() 71KOEventViewer::~KOEventViewer()
72{ 72{
73} 73}
74 74
75void KOEventViewer::printMe() 75void KOEventViewer::printMe()
76{ 76{
77#ifdef DESKTOP_VERSION 77#ifdef DESKTOP_VERSION
78 78
79 KOPrintPrefs pp ( this ); 79 KOPrintPrefs pp ( this );
80 if (!pp.exec() ) 80 if (!pp.exec() )
81 return; 81 return;
82 int scaleval = pp.printMode() ; 82 int scaleval = pp.printMode() ;
83 83
84 QPrinter printer; 84 QPrinter printer;
85 if (!printer.setup() ) 85 if (!printer.setup() )
86 return; 86 return;
87 QPainter p; 87 QPainter p;
88 p.begin ( &printer ); 88 p.begin ( &printer );
89 QPaintDeviceMetrics m = QPaintDeviceMetrics ( &printer ); 89 QPaintDeviceMetrics m = QPaintDeviceMetrics ( &printer );
90 float dx, dy; 90 float dx, dy;
91 int wid = (m.width() * 9)/10; 91 int wid = (m.width() * 9)/10;
92 dx = (float) wid/(float)contentsWidth (); 92 dx = (float) wid/(float)contentsWidth ();
93 dy = (float)(m.height()) / (float)contentsHeight (); 93 dy = (float)(m.height()) / (float)contentsHeight ();
94 float scale; 94 float scale;
95 // scale to fit the width or height of the paper 95 // scale to fit the width or height of the paper
96 if ( dx < dy ) 96 if ( dx < dy )
97 scale = dx; 97 scale = dx;
98 else 98 else
99 scale = dy; 99 scale = dy;
100 100
101 p.translate( m.width()/10,0 ); 101 p.translate( m.width()/10,0 );
102 qDebug("Scale: %f ", scale );
103 if ( scaleval == 2 || scaleval == 1 && scale < 1.0 ) { 102 if ( scaleval == 2 || scaleval == 1 && scale < 1.0 ) {
104 qDebug("SCALE ");
105 p.scale( scale, scale ); 103 p.scale( scale, scale );
106 } 104 }
107 drawContents ( &p, 0,0, contentsWidth (), contentsHeight () ); 105 drawContents ( &p, 0,0, contentsWidth (), contentsHeight () );
108 p.end(); 106 p.end();
109#endif 107#endif
110 108
111} 109}
112void KOEventViewer::setSource(const QString& n) 110void KOEventViewer::setSource(const QString& n)
113{ 111{
114 112
115 if ( n.left(3) == "uid" ) 113 if ( n.left(3) == "uid" )
116#ifdef DESKTOP_VERSION 114#ifdef DESKTOP_VERSION
117 { 115 {
118 KABC::StdAddressBook* AddressBook = KABC::StdAddressBook::self( true ); 116 KABC::StdAddressBook* AddressBook = KABC::StdAddressBook::self( true );
119 KABC::AddressBook::Iterator it; 117 KABC::AddressBook::Iterator it;
120 for( it = AddressBook->begin(); it != AddressBook->end(); ++it ) { 118 for( it = AddressBook->begin(); it != AddressBook->end(); ++it ) {
121 // LR I do not understand, why the uid string is different on zaurus and desktop 119 // LR I do not understand, why the uid string is different on zaurus and desktop
122 QString uid = "uid://"+(*it).uid(); 120 QString uid = "uid://"+(*it).uid();
123 121
124 //qDebug("for *%s* +%s+ ", n.latin1(), uid.latin1()); 122 //qDebug("for *%s* +%s+ ", n.latin1(), uid.latin1());
125 if (n == uid ) { 123 if (n == uid ) {
126 //qDebug("found %s ",(*it).mobileHomePhone().latin1() ); 124 //qDebug("found %s ",(*it).mobileHomePhone().latin1() );
127 QDialog dia( this,"dia123", true ); 125 QDialog dia( this,"dia123", true );
128 dia.setCaption( i18n("Details of attendee") ); 126 dia.setCaption( i18n("Details of attendee") );
129 QVBoxLayout lay ( &dia ); 127 QVBoxLayout lay ( &dia );
130 KABC::AddresseeView av ( &dia ); 128 KABC::AddresseeView av ( &dia );
131 av.setAddressee( (*it) ); 129 av.setAddressee( (*it) );
132 lay.addWidget( &av ); 130 lay.addWidget( &av );
133 if ( QApplication::desktop()->width() < 480 ) 131 if ( QApplication::desktop()->width() < 480 )
134 dia.resize( 220, 240); 132 dia.resize( 220, 240);
135 else { 133 else {
136 dia.resize( 400,400); 134 dia.resize( 400,400);
137 } 135 }
138 dia.exec(); 136 dia.exec();
139 break; 137 break;
140 } 138 }
141 } 139 }
142 return; 140 return;
143 } 141 }
144#else 142#else
145 { 143 {
146 if ( "uid:organizer" == n ) { 144 if ( "uid:organizer" == n ) {
147 ExternalAppHandler::instance()->requestDetailsFromKAPI("", mCurrentIncidence->organizer(),""); 145 ExternalAppHandler::instance()->requestDetailsFromKAPI("", mCurrentIncidence->organizer(),"");
148 return; 146 return;
149 } 147 }
150 QPtrList<Attendee> attendees = mCurrentIncidence->attendees(); 148 QPtrList<Attendee> attendees = mCurrentIncidence->attendees();
151 if (attendees.count()) { 149 if (attendees.count()) {
152 Attendee *a; 150 Attendee *a;
153 for(a=attendees.first();a;a=attendees.next()) { 151 for(a=attendees.first();a;a=attendees.next()) {
154 if ( "uid:"+a->uid() == n ) { 152 if ( "uid:"+a->uid() == n ) {
155 bool res = ExternalAppHandler::instance()->requestDetailsFromKAPI(a->name(), a->email(), a->uid()); 153 bool res = ExternalAppHandler::instance()->requestDetailsFromKAPI(a->name(), a->email(), a->uid());
156 return; 154 return;
157 } 155 }
158 } 156 }
159 } 157 }
160 return; 158 return;
161 } 159 }
162 //requestNameEmailUidListFromKAPI("QPE/Application/kopi", this->name() /* name is here the unique uid*/); 160 //requestNameEmailUidListFromKAPI("QPE/Application/kopi", this->name() /* name is here the unique uid*/);
163 // the result should now arrive through method insertAttendees 161 // the result should now arrive through method insertAttendees
164 //QString uid = "uid:"+(*it).uid(); 162 //QString uid = "uid:"+(*it).uid();
165#endif 163#endif
166 if ( n.left(6) == "mailto" ) { 164 if ( n.left(6) == "mailto" ) {
167 // qDebug("KOEventViewer::setSource %s ", n.mid(7).latin1()); 165 // qDebug("KOEventViewer::setSource %s ", n.mid(7).latin1());
168#ifndef DESKTOP_VERSION 166#ifndef DESKTOP_VERSION
169 if ( n.mid(7,3) == "ALL" ) { 167 if ( n.mid(7,3) == "ALL" ) {
170 qDebug("all ");
171 mailToAttendees( true ); 168 mailToAttendees( true );
172 } else if ( n.mid(7,4) == "RSVP" ) { 169 } else if ( n.mid(7,4) == "RSVP" ) {
173 mailToAttendees( false ); 170 mailToAttendees( false );
174 qDebug("rsvp ");
175 } else { 171 } else {
176 QCopEnvelope e("QPE/Application/ompi", "newMail(QString)" ); 172 QCopEnvelope e("QPE/Application/ompi", "newMail(QString)" );
177 e << n.mid(7); 173 e << n.mid(7);
178 } 174 }
179#endif 175#endif
180 176
181 } 177 }
182 178
183 179
184#ifndef KORG_NODCOP 180#ifndef KORG_NODCOP
185 kdDebug() << "KOEventViewer::setSource(): " << n << endl; 181 kdDebug() << "KOEventViewer::setSource(): " << n << endl;
186 QString tmpStr; 182 QString tmpStr;
187 if (n.startsWith("mailto:")) { 183 if (n.startsWith("mailto:")) {
188 KApplication::kApplication()->invokeMailer(n.mid(7),QString::null); 184 KApplication::kApplication()->invokeMailer(n.mid(7),QString::null);
189 //emit showIncidence(n); 185 //emit showIncidence(n);
190 return; 186 return;
191 } else if (n.startsWith("uid:")) { 187 } else if (n.startsWith("uid:")) {
192 DCOPClient *client = KApplication::kApplication()->dcopClient(); 188 DCOPClient *client = KApplication::kApplication()->dcopClient();
193 const QByteArray noParamData; 189 const QByteArray noParamData;
194 const QByteArray paramData; 190 const QByteArray paramData;
195 QByteArray replyData; 191 QByteArray replyData;
196 QCString replyTypeStr; 192 QCString replyTypeStr;
197#define PING_ABBROWSER (client->call("kaddressbook", "KAddressBookIface", "interfaces()", noParamData, replyTypeStr, replyData)) 193#define PING_ABBROWSER (client->call("kaddressbook", "KAddressBookIface", "interfaces()", noParamData, replyTypeStr, replyData))
198 bool foundAbbrowser = PING_ABBROWSER; 194 bool foundAbbrowser = PING_ABBROWSER;
199 195
200 if (foundAbbrowser) { 196 if (foundAbbrowser) {
201 //KAddressbook is already running, so just DCOP to it to bring up the contact editor 197 //KAddressbook is already running, so just DCOP to it to bring up the contact editor
202 //client->send("kaddressbook","KAddressBookIface", 198 //client->send("kaddressbook","KAddressBookIface",
203 QDataStream arg(paramData, IO_WriteOnly); 199 QDataStream arg(paramData, IO_WriteOnly);
204 arg << n.mid(6); 200 arg << n.mid(6);
205 client->send("kaddressbook", "KAddressBookIface", "showContactEditor( QString )", paramData); 201 client->send("kaddressbook", "KAddressBookIface", "showContactEditor( QString )", paramData);
206 return; 202 return;
207 } else { 203 } else {
208 /* 204 /*
209 KaddressBook is not already running. Pass it the UID of the contact via the command line while starting it - its neater. 205 KaddressBook is not already running. Pass it the UID of the contact via the command line while starting it - its neater.
210 We start it without its main interface 206 We start it without its main interface
211 */ 207 */
212 KIconLoader* iconLoader = new KIconLoader(); 208 KIconLoader* iconLoader = new KIconLoader();
213 QString iconPath = iconLoader->iconPath("go",KIcon::Small); 209 QString iconPath = iconLoader->iconPath("go",KIcon::Small);
214 ActionManager::setStartedKAddressBook(true); 210 ActionManager::setStartedKAddressBook(true);
215 tmpStr = "kaddressbook --editor-only --uid "; 211 tmpStr = "kaddressbook --editor-only --uid ";
216 tmpStr += KProcess::quote(n.mid(6)); 212 tmpStr += KProcess::quote(n.mid(6));
217 KRun::runCommand(tmpStr,"KAddressBook",iconPath); 213 KRun::runCommand(tmpStr,"KAddressBook",iconPath);
218 return; 214 return;
219 } 215 }
220 } else { 216 } else {
221 //QTextBrowser::setSource(n); 217 //QTextBrowser::setSource(n);
222 } 218 }
223#endif 219#endif
224} 220}
225void KOEventViewer::mailToAttendees( bool all ) 221void KOEventViewer::mailToAttendees( bool all )
226{ 222{
227 QPtrList<Attendee> attendees = mCurrentIncidence->attendees(); 223 QPtrList<Attendee> attendees = mCurrentIncidence->attendees();
228 if (attendees.count() == 0) return; 224 if (attendees.count() == 0) return;
229 QStringList nameList; 225 QStringList nameList;
230 QStringList emailList; 226 QStringList emailList;
231 QStringList uidList; 227 QStringList uidList;
232 Attendee* a; 228 Attendee* a;
233 for(a=attendees.first();a;a=attendees.next()) { 229 for(a=attendees.first();a;a=attendees.next()) {
234 if ( !all && !a->RSVP() ) continue; 230 if ( !all && !a->RSVP() ) continue;
235 if (!a->email().isEmpty()) { 231 if (!a->email().isEmpty()) {
236 nameList.append (a->name() ); 232 nameList.append (a->name() );
237 emailList.append (a->email() ); 233 emailList.append (a->email() );
238 uidList.append (a->uid() ); 234 uidList.append (a->uid() );
diff --git a/korganizer/koglobals.cpp b/korganizer/koglobals.cpp
index 8016034..9ece77f 100644
--- a/korganizer/koglobals.cpp
+++ b/korganizer/koglobals.cpp
@@ -1,143 +1,114 @@
1/* 1/*
2 This file is part of KOrganizer. 2 This file is part of KOrganizer.
3 Copyright (c) 2002 Cornelius Schumacher <schumacher@kde.org> 3 Copyright (c) 2002 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 <qapplication.h> 24#include <qapplication.h>
25 25
26#include <kdebug.h> 26#include <kdebug.h>
27#include <kglobal.h> 27#include <kglobal.h>
28#include <kconfig.h> 28#include <kconfig.h>
29#include <kstandarddirs.h> 29#include <kstandarddirs.h>
30#include <kglobalsettings.h> 30#include <kglobalsettings.h>
31#include <klocale.h> 31#include <klocale.h>
32 32
33#include <kcalendarsystem.h> 33#include <kcalendarsystem.h>
34 34
35#ifndef KORG_NOKALARMD
36#include "kalarmdclient.h"
37#endif
38#include "simplealarmclient.h"
39 35
40#include "koglobals.h" 36#include "koglobals.h"
41#include "koprefs.h" 37#include "koprefs.h"
42 38
43class NopAlarmClient : public AlarmClient
44{
45 public:
46 void startDaemon() {}
47 bool setCalendars( const QStringList & ) { return false; }
48 bool addCalendar( const QString & ) { return false; }
49 bool removeCalendar( const QString & ) { return false; }
50 bool reloadCalendar( const QString & ) { return false; }
51};
52 39
53KOGlobals *KOGlobals::mSelf = 0; 40KOGlobals *KOGlobals::mSelf = 0;
54 41
55KOGlobals *KOGlobals::self() 42KOGlobals *KOGlobals::self()
56{ 43{
57 if (!mSelf) { 44 if (!mSelf) {
58 mSelf = new KOGlobals; 45 mSelf = new KOGlobals;
59 } 46 }
60 47
61 return mSelf; 48 return mSelf;
62} 49}
63 50
64KOGlobals::KOGlobals() 51KOGlobals::KOGlobals()
65{ 52{
66 KConfig *cfg = KOGlobals::config(); 53 KConfig *cfg = KOGlobals::config();
67 54
68 cfg->setGroup("General"); 55 cfg->setGroup("General");
69 mCalendarSystem = KGlobal::locale()->calendar(); 56 mCalendarSystem = KGlobal::locale()->calendar();
70 57
71 cfg->setGroup("AlarmDaemon");
72 QString alarmClient = cfg->readEntry( "Daemon", "kalarmd" );
73 if ( alarmClient == "simple" ) {
74 mAlarmClient = new SimpleAlarmClient;
75#ifndef KORG_NOKALARMD
76 } else if ( alarmClient == "kalarmd" ) {
77 mAlarmClient = new KalarmdClient;
78#endif
79 } else {
80 mAlarmClient = new NopAlarmClient;
81 }
82} 58}
83 59
84KConfig* KOGlobals::config() 60KConfig* KOGlobals::config()
85{ 61{
86 static KConfig *mConfig = 0; 62 static KConfig *mConfig = 0;
87 if (!mConfig) { 63 if (!mConfig) {
88 KOPrefs *p = KOPrefs::instance(); 64 KOPrefs *p = KOPrefs::instance();
89 mConfig = p->getConfig(); 65 mConfig = p->getConfig();
90 //mConfig = new KConfig( locateLocal( "config", "korganizerrc" ) ); 66 //mConfig = new KConfig( locateLocal( "config", "korganizerrc" ) );
91 } 67 }
92 return mConfig; 68 return mConfig;
93} 69}
94 70
95KOGlobals::~KOGlobals() 71KOGlobals::~KOGlobals()
96{ 72{
97 delete mAlarmClient; 73
98} 74}
99 75
100const KCalendarSystem *KOGlobals::calendarSystem() const 76const KCalendarSystem *KOGlobals::calendarSystem() const
101{ 77{
102 return mCalendarSystem; 78 return mCalendarSystem;
103} 79}
104 80
105AlarmClient *KOGlobals::alarmClient() const
106{
107 return mAlarmClient;
108}
109
110void KOGlobals::fitDialogToScreen( QWidget *wid, bool force ) 81void KOGlobals::fitDialogToScreen( QWidget *wid, bool force )
111{ 82{
112 bool resized = false; 83 bool resized = false;
113 84
114 int w = wid->frameSize().width(); 85 int w = wid->frameSize().width();
115 int h = wid->frameSize().height(); 86 int h = wid->frameSize().height();
116 87
117 QRect desk = KGlobalSettings::desktopGeometry(wid); 88 QRect desk = KGlobalSettings::desktopGeometry(wid);
118 if ( w > desk.width() ) { 89 if ( w > desk.width() ) {
119 w = desk.width(); 90 w = desk.width();
120 resized = true; 91 resized = true;
121 } 92 }
122 // Yuck this hack is ugly. Is the -30 really to circumvent the size of 93 // Yuck this hack is ugly. Is the -30 really to circumvent the size of
123 // kicker?! 94 // kicker?!
124 if ( h > desk.height() - 30 ) { 95 if ( h > desk.height() - 30 ) {
125 h = desk.height() - 30; 96 h = desk.height() - 30;
126 resized = true; 97 resized = true;
127 } 98 }
128 99
129 if ( resized || force ) { 100 if ( resized || force ) {
130 wid->resize( w, h ); 101 wid->resize( w, h );
131 wid->move( desk.x(), desk.y()+15 ); 102 wid->move( desk.x(), desk.y()+15 );
132 if ( force ) wid->setFixedSize( w, h ); 103 if ( force ) wid->setFixedSize( w, h );
133 } 104 }
134} 105}
135 106
136bool KOGlobals::reverseLayout() 107bool KOGlobals::reverseLayout()
137{ 108{
138#if QT_VERSION >= 0x030000 109#if QT_VERSION >= 0x030000
139 return QApplication::reverseLayout(); 110 return QApplication::reverseLayout();
140#else 111#else
141 return false; 112 return false;
142#endif 113#endif
143} 114}
diff --git a/korganizer/koglobals.h b/korganizer/koglobals.h
index 357ff5f..b3ff67b 100644
--- a/korganizer/koglobals.h
+++ b/korganizer/koglobals.h
@@ -1,59 +1,56 @@
1/* 1/*
2 This file is part of KOrganizer. 2 This file is part of KOrganizer.
3 Copyright (c) 2002 Cornelius Schumacher <schumacher@kde.org> 3 Copyright (c) 2002 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#ifndef KORG_GLOBALS_H 23#ifndef KORG_GLOBALS_H
24#define KORG_GLOBALS_H 24#define KORG_GLOBALS_H
25 25
26class KCalendarSystem; 26class KCalendarSystem;
27class AlarmClient; 27class AlarmClient;
28 28
29class KConfig; 29class KConfig;
30 30
31class KOGlobals 31class KOGlobals
32{ 32{
33 public: 33 public:
34 static KOGlobals *self(); 34 static KOGlobals *self();
35 35
36 enum { EVENTADDED, EVENTEDITED, EVENTDELETED }; 36 enum { EVENTADDED, EVENTEDITED, EVENTDELETED };
37 enum { PRIORITY_MODIFIED, COMPLETION_MODIFIED, CATEGORY_MODIFIED, UNKNOWN_MODIFIED }; 37 enum { PRIORITY_MODIFIED, COMPLETION_MODIFIED, CATEGORY_MODIFIED, UNKNOWN_MODIFIED };
38 38
39 static void fitDialogToScreen( QWidget *widget, bool force=false ); 39 static void fitDialogToScreen( QWidget *widget, bool force=false );
40 static KConfig *config(); 40 static KConfig *config();
41 41
42 static bool reverseLayout(); 42 static bool reverseLayout();
43 43
44 const KCalendarSystem *calendarSystem() const; 44 const KCalendarSystem *calendarSystem() const;
45 45
46 AlarmClient *alarmClient() const;
47
48 protected: 46 protected:
49 KOGlobals(); 47 KOGlobals();
50 ~KOGlobals(); 48 ~KOGlobals();
51 49
52 private: 50 private:
53 static KOGlobals *mSelf; 51 static KOGlobals *mSelf;
54 52
55 const KCalendarSystem *mCalendarSystem; 53 const KCalendarSystem *mCalendarSystem;
56 AlarmClient *mAlarmClient;
57}; 54};
58 55
59#endif 56#endif
diff --git a/korganizer/koincidenceeditor.cpp b/korganizer/koincidenceeditor.cpp
index 51df123..9813a80 100644
--- a/korganizer/koincidenceeditor.cpp
+++ b/korganizer/koincidenceeditor.cpp
@@ -1,109 +1,108 @@
1/* 1/*
2 This file is part of KOrganizer. 2 This file is part of KOrganizer.
3 Copyright (c) 2001 Cornelius Schumacher <schumacher@kde.org> 3 Copyright (c) 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 <qtooltip.h> 24#include <qtooltip.h>
25#include <qframe.h> 25#include <qframe.h>
26#include <qpixmap.h> 26#include <qpixmap.h>
27#include <qlayout.h> 27#include <qlayout.h>
28#include <qwidgetstack.h> 28#include <qwidgetstack.h>
29#include <qdatetime.h> 29#include <qdatetime.h>
30#include <qdir.h> 30#include <qdir.h>
31 31
32#include <kdebug.h> 32#include <kdebug.h>
33#include <klocale.h> 33#include <klocale.h>
34#include <kstandarddirs.h> 34#include <kstandarddirs.h>
35#include <kmessagebox.h> 35#include <kmessagebox.h>
36#include <kfiledialog.h> 36#include <kfiledialog.h>
37 37
38#include <libkdepim/categoryselectdialog.h> 38#include <libkdepim/categoryselectdialog.h>
39#include <libkdepim/kinputdialog.h> 39#include <libkdepim/kinputdialog.h>
40 40
41#include <libkcal/calendarlocal.h> 41#include <libkcal/calendarlocal.h>
42#include <libkcal/icalformat.h> 42#include <libkcal/icalformat.h>
43 43
44#include "koprefs.h" 44#include "koprefs.h"
45#include "koglobals.h"
46 45
47#include "koincidenceeditor.h" 46#include "koincidenceeditor.h"
48 47
49KOIncidenceEditor::KOIncidenceEditor( const QString &caption, 48KOIncidenceEditor::KOIncidenceEditor( const QString &caption,
50 Calendar *calendar, QWidget *parent ) : 49 Calendar *calendar, QWidget *parent ) :
51 KDialogBase( Tabbed, caption, Ok | Apply | Cancel |/* Default | */User1, Ok, 50 KDialogBase( Tabbed, caption, Ok | Apply | Cancel |/* Default | */User1, Ok,
52 parent, caption, true, false ), 51 parent, caption, true, false ),
53 mSaveTemplateDialog( 0 ) 52 mSaveTemplateDialog( 0 )
54{ 53{
55 mCalendar = calendar; 54 mCalendar = calendar;
56 55
57 setButtonText( Default, i18n("Template...") ); 56 setButtonText( Default, i18n("Template...") );
58 57
59 QString saveTemplateText; 58 QString saveTemplateText;
60 // if ( KOPrefs::instance()->mCompactDialogs ) { 59 // if ( KOPrefs::instance()->mCompactDialogs ) {
61// showButton( User1, false ); 60// showButton( User1, false );
62// showButton( Apply, false ); 61// showButton( Apply, false );
63// } else { 62// } else {
64 showButton( Apply, false ); 63 showButton( Apply, false );
65 saveTemplateText = i18n("Ok+Agenda"); 64 saveTemplateText = i18n("Ok+Agenda");
66 // } 65 // }
67 setButtonText( User1, saveTemplateText ); 66 setButtonText( User1, saveTemplateText );
68 67
69 //mCategoryDialog = new KPIM::CategorySelectDialog( KOPrefs::instance(), this ); 68 //mCategoryDialog = new KPIM::CategorySelectDialog( KOPrefs::instance(), this );
70 // KOGlobals::fitDialogToScreen( mCategoryDialog ); 69 // KOGlobals::fitDialogToScreen( mCategoryDialog );
71 70
72 //connect(mCategoryDialog,SIGNAL(editCategories()),SIGNAL(editCategories())); 71 //connect(mCategoryDialog,SIGNAL(editCategories()),SIGNAL(editCategories()));
73 72
74 //connect( this, SIGNAL( defaultClicked() ), SLOT( slotLoadTemplate() ) ); 73 //connect( this, SIGNAL( defaultClicked() ), SLOT( slotLoadTemplate() ) );
75 // connect( this, SIGNAL( user1Clicked() ), SLOT( slotSaveTemplate() ) ); 74 // connect( this, SIGNAL( user1Clicked() ), SLOT( slotSaveTemplate() ) );
76 connect( this, SIGNAL( user1Clicked() ), SLOT( slotShowIncidence() ) ); 75 connect( this, SIGNAL( user1Clicked() ), SLOT( slotShowIncidence() ) );
77} 76}
78 77
79KOIncidenceEditor::~KOIncidenceEditor() 78KOIncidenceEditor::~KOIncidenceEditor()
80{ 79{
81 //delete mCategoryDialog; 80 //delete mCategoryDialog;
82} 81}
83 82
84void KOIncidenceEditor::setupAttendeesTab() 83void KOIncidenceEditor::setupAttendeesTab()
85{ 84{
86 QFrame *topFrame = addPage(i18n("Attendees")); 85 QFrame *topFrame = addPage(i18n("Attendees"));
87 86
88 QBoxLayout *topLayout = new QVBoxLayout(topFrame); 87 QBoxLayout *topLayout = new QVBoxLayout(topFrame);
89 88
90 mDetails = new KOEditorDetails(spacingHint(),topFrame); 89 mDetails = new KOEditorDetails(spacingHint(),topFrame);
91 topLayout->addWidget(mDetails); 90 topLayout->addWidget(mDetails);
92} 91}
93 92
94 93
95void KOIncidenceEditor::slotApply() 94void KOIncidenceEditor::slotApply()
96{ 95{
97 processInput( false ); 96 processInput( false );
98} 97}
99void KOIncidenceEditor::accept() 98void KOIncidenceEditor::accept()
100{ 99{
101 slotOk(); 100 slotOk();
102} 101}
103void KOIncidenceEditor::slotOk() 102void KOIncidenceEditor::slotOk()
104{ 103{
105 if ( processInput( false ) ) QDialog::accept(); 104 if ( processInput( false ) ) QDialog::accept();
106} 105}
107 106
108void KOIncidenceEditor::updateCategoryConfig() 107void KOIncidenceEditor::updateCategoryConfig()
109{ 108{
diff --git a/korganizer/kolistview.cpp b/korganizer/kolistview.cpp
index 341f473..e1b393d 100644
--- a/korganizer/kolistview.cpp
+++ b/korganizer/kolistview.cpp
@@ -270,272 +270,275 @@ KOListView::KOListView(Calendar *calendar, QWidget *parent,
270 i18n("Deselect all"),this, 270 i18n("Deselect all"),this,
271 SLOT(clearSelection()),true); 271 SLOT(clearSelection()),true);
272 mPopupMenu->addAdditionalItem(QIconSet(QPixmap()), 272 mPopupMenu->addAdditionalItem(QIconSet(QPixmap()),
273 i18n("Delete all selected"),this, 273 i18n("Delete all selected"),this,
274 SLOT(deleteAll()),true); 274 SLOT(deleteAll()),true);
275 mPopupMenu->insertSeparator(); 275 mPopupMenu->insertSeparator();
276 QPopupMenu * exportPO = new QPopupMenu ( this ); 276 QPopupMenu * exportPO = new QPopupMenu ( this );
277 mPopupMenu->insertItem( i18n("Export selected"), exportPO ); 277 mPopupMenu->insertItem( i18n("Export selected"), exportPO );
278 exportPO->insertItem( i18n("As iCal (ics) file..."),this, 278 exportPO->insertItem( i18n("As iCal (ics) file..."),this,
279 SLOT(saveToFile())); 279 SLOT(saveToFile()));
280 exportPO->insertItem( i18n("As vCal (vcs) file..."),this, 280 exportPO->insertItem( i18n("As vCal (vcs) file..."),this,
281 SLOT(saveToFileVCS())); 281 SLOT(saveToFileVCS()));
282 exportPO->insertItem( i18n("Journal/Details..."),this, 282 exportPO->insertItem( i18n("Journal/Details..."),this,
283 SLOT(saveDescriptionToFile())); 283 SLOT(saveDescriptionToFile()));
284 // mPopupMenu->insertSeparator(); 284 // mPopupMenu->insertSeparator();
285 mPopupMenu->addAdditionalItem(QIconSet(QPixmap()), 285 mPopupMenu->addAdditionalItem(QIconSet(QPixmap()),
286 i18n("Add Categ. to selected..."),this, 286 i18n("Add Categ. to selected..."),this,
287 SLOT(addCat()),true); 287 SLOT(addCat()),true);
288 mPopupMenu->addAdditionalItem(QIconSet(QPixmap()), 288 mPopupMenu->addAdditionalItem(QIconSet(QPixmap()),
289 i18n("Set Categ. for selected..."),this, 289 i18n("Set Categ. for selected..."),this,
290 SLOT(setCat()),true); 290 SLOT(setCat()),true);
291 //mPopupMenu->insertSeparator(); 291 //mPopupMenu->insertSeparator();
292 mPopupMenu->addAdditionalItem(QIconSet(QPixmap()), 292 mPopupMenu->addAdditionalItem(QIconSet(QPixmap()),
293 i18n("Set alarm for selected..."),this, 293 i18n("Set alarm for selected..."),this,
294 SLOT(setAlarm()),true); 294 SLOT(setAlarm()),true);
295 295
296 296
297#ifndef DESKTOP_VERSION 297#ifndef DESKTOP_VERSION
298 mPopupMenu->insertSeparator(); 298 mPopupMenu->insertSeparator();
299 mPopupMenu->addAdditionalItem(QIconSet(QPixmap()), 299 mPopupMenu->addAdditionalItem(QIconSet(QPixmap()),
300 i18n("Beam selected via IR"),this, 300 i18n("Beam selected via IR"),this,
301 SLOT(beamSelected()),true); 301 SLOT(beamSelected()),true);
302#endif 302#endif
303 /* 303 /*
304 mPopupMenu = new QPopupMenu; 304 mPopupMenu = new QPopupMenu;
305 mPopupMenu->insertItem(i18n("Edit Event"), this, 305 mPopupMenu->insertItem(i18n("Edit Event"), this,
306 SLOT (editEvent())); 306 SLOT (editEvent()));
307 mPopupMenu->insertItem(SmallIcon("delete"), i18n("Delete Event"), this, 307 mPopupMenu->insertItem(SmallIcon("delete"), i18n("Delete Event"), this,
308 SLOT (deleteEvent())); 308 SLOT (deleteEvent()));
309 mPopupMenu->insertSeparator(); 309 mPopupMenu->insertSeparator();
310 mPopupMenu->insertItem(i18n("Show Dates"), this, 310 mPopupMenu->insertItem(i18n("Show Dates"), this,
311 SLOT(showDates())); 311 SLOT(showDates()));
312 mPopupMenu->insertItem(i18n("Hide Dates"), this, 312 mPopupMenu->insertItem(i18n("Hide Dates"), this,
313 SLOT(hideDates())); 313 SLOT(hideDates()));
314 */ 314 */
315 QObject::connect(mListView,SIGNAL( newEvent()), 315 QObject::connect(mListView,SIGNAL( newEvent()),
316 this,SIGNAL(signalNewEvent())); 316 this,SIGNAL(signalNewEvent()));
317 QObject::connect(mListView,SIGNAL(doubleClicked(QListViewItem *)), 317 QObject::connect(mListView,SIGNAL(doubleClicked(QListViewItem *)),
318 this,SLOT(defaultItemAction(QListViewItem *))); 318 this,SLOT(defaultItemAction(QListViewItem *)));
319 QObject::connect(mListView,SIGNAL(rightButtonPressed( QListViewItem *, 319 QObject::connect(mListView,SIGNAL(rightButtonPressed( QListViewItem *,
320 const QPoint &, int )), 320 const QPoint &, int )),
321 this,SLOT(popupMenu(QListViewItem *,const QPoint &,int))); 321 this,SLOT(popupMenu(QListViewItem *,const QPoint &,int)));
322 QObject::connect(mListView,SIGNAL(currentChanged(QListViewItem *)), 322 QObject::connect(mListView,SIGNAL(currentChanged(QListViewItem *)),
323 SLOT(processSelectionChange(QListViewItem *))); 323 SLOT(processSelectionChange(QListViewItem *)));
324 QObject::connect(mListView,SIGNAL(showIncidence(Incidence *)), 324 QObject::connect(mListView,SIGNAL(showIncidence(Incidence *)),
325 SIGNAL(showIncidenceSignal(Incidence *)) ); 325 SIGNAL(showIncidenceSignal(Incidence *)) );
326 326
327 readSettings(KOGlobals::config(),"KOListView Layout"); 327 readSettings(KOGlobals::config(),"KOListView Layout");
328} 328}
329 329
330KOListView::~KOListView() 330KOListView::~KOListView()
331{ 331{
332 delete mPopupMenu; 332 delete mPopupMenu;
333} 333}
334
334QString KOListView::getWhatsThisText(QPoint p) 335QString KOListView::getWhatsThisText(QPoint p)
335{ 336{
336 KOListViewItem* item = ( KOListViewItem* ) mListView->itemAt( p ); 337 KOListViewItem* item = ( KOListViewItem* ) mListView->itemAt( p );
337 if ( item ) 338 if ( item )
338 return KIncidenceFormatter::instance()->getFormattedText( item->data(), 339 return KIncidenceFormatter::instance()->getFormattedText( item->data(),
339 KOPrefs::instance()->mWTshowDetails, 340 KOPrefs::instance()->mWTshowDetails,
340 KOPrefs::instance()->mWTshowCreated, 341 KOPrefs::instance()->mWTshowCreated,
341 KOPrefs::instance()->mWTshowChanged); 342 KOPrefs::instance()->mWTshowChanged);
342 return i18n("That is the list view" ); 343 return i18n("That is the list view" );
343 344
344} 345}
345 346
346void KOListView::updateList() 347void KOListView::updateList()
347{ 348{
348 // qDebug(" KOListView::updateList() "); 349 // qDebug(" KOListView::updateList() ");
349 350
350} 351}
351 352
352void KOListView::addCat( ) 353void KOListView::addCat( )
353{ 354{
354 setCategories( false ); 355 setCategories( false );
355} 356}
356void KOListView::setCat() 357void KOListView::setCat()
357{ 358{
358 setCategories( true ); 359 setCategories( true );
359} 360}
360void KOListView::setAlarm() 361void KOListView::setAlarm()
361{ 362{
362 KOAlarmPrefs kap( this); 363 KOAlarmPrefs kap( this);
363 if ( !kap.exec() ) 364 if ( !kap.exec() )
364 return; 365 return;
365 366
366 367
367 QStringList itemList; 368 QStringList itemList;
368 QPtrList<KOListViewItem> sel ; 369 QPtrList<KOListViewItem> sel ;
369 QListViewItem *qitem = mListView->firstChild (); 370 QListViewItem *qitem = mListView->firstChild ();
370 while ( qitem ) { 371 while ( qitem ) {
371 if ( qitem->isSelected() ) { 372 if ( qitem->isSelected() ) {
372 Incidence* inc = ((KOListViewItem *) qitem)->data(); 373 Incidence* inc = ((KOListViewItem *) qitem)->data();
373 if ( inc->type() != "Journal" ) { 374 if ( inc->type() != "Journal" ) {
374 if ( inc->type() == "Todo" ) { 375 if ( inc->type() == "Todo" ) {
375 if ( ((Todo*)inc)->hasDueDate() ) 376 if ( ((Todo*)inc)->hasDueDate() )
376 sel.append(((KOListViewItem *)qitem)); 377 sel.append(((KOListViewItem *)qitem));
377 } else 378 } else
378 sel.append(((KOListViewItem *)qitem)); 379 sel.append(((KOListViewItem *)qitem));
379 } 380 }
380 } 381 }
381 qitem = qitem->nextSibling(); 382 qitem = qitem->nextSibling();
382 } 383 }
383 int count = 0; 384 int count = 0;
384 KOListViewItem * item, *temp; 385 KOListViewItem * item, *temp;
385 item = sel.first(); 386 item = sel.first();
386 Incidence* inc; 387 Incidence* inc;
387 while ( item ) { 388 while ( item ) {
388 inc = item->data(); 389 inc = item->data();
389 ++count; 390 ++count;
390 if (kap.mAlarmButton->isChecked()) { 391 if (kap.mAlarmButton->isChecked()) {
391 if (inc->alarms().count() == 0) 392 if (inc->alarms().count() == 0)
392 inc->newAlarm(); 393 inc->newAlarm();
393 QPtrList<Alarm> alarms = inc->alarms(); 394 QPtrList<Alarm> alarms = inc->alarms();
394 Alarm *alarm; 395 Alarm *alarm;
395 for (alarm = alarms.first(); alarm; alarm = alarms.next() ) { 396 for (alarm = alarms.first(); alarm; alarm = alarms.next() ) {
396 alarm->setEnabled(true); 397 alarm->setEnabled(true);
397 int j = kap.mAlarmTimeEdit->value()* -60; 398 int j = kap.mAlarmTimeEdit->value()* -60;
398 if (kap.mAlarmIncrCombo->currentItem() == 1) 399 if (kap.mAlarmIncrCombo->currentItem() == 1)
399 j = j * 60; 400 j = j * 60;
400 else if (kap.mAlarmIncrCombo->currentItem() == 2) 401 else if (kap.mAlarmIncrCombo->currentItem() == 2)
401 j = j * (60 * 24); 402 j = j * (60 * 24);
402 alarm->setStartOffset( j ); 403 alarm->setStartOffset( j );
403 404
404 if (!kap.mAlarmProgram.isEmpty() && kap.mAlarmProgramButton->isOn()) { 405 if (!kap.mAlarmProgram.isEmpty() && kap.mAlarmProgramButton->isOn()) {
405 alarm->setProcedureAlarm(kap.mAlarmProgram); 406 alarm->setProcedureAlarm(kap.mAlarmProgram);
406 } 407 }
407 else if (!kap.mAlarmSound.isEmpty() && kap.mAlarmSoundButton->isOn()) 408 else if (!kap.mAlarmSound.isEmpty() && kap.mAlarmSoundButton->isOn())
408 alarm->setAudioAlarm(kap.mAlarmSound); 409 alarm->setAudioAlarm(kap.mAlarmSound);
409 else 410 else
410 alarm->setType(Alarm::Invalid); 411 alarm->setType(Alarm::Invalid);
411 //alarm->setAudioAlarm("default"); 412 //alarm->setAudioAlarm("default");
412 // TODO: Deal with multiple alarms 413 // TODO: Deal with multiple alarms
413 break; // For now, stop after the first alarm 414 break; // For now, stop after the first alarm
414 } 415 }
415 } else { 416 } else {
416 Alarm* alarm = inc->alarms().first(); 417 Alarm* alarm = inc->alarms().first();
417 if ( alarm ) { 418 if ( alarm ) {
418 alarm->setEnabled(false); 419 alarm->setEnabled(false);
419 alarm->setType(Alarm::Invalid); 420 alarm->setType(Alarm::Invalid);
420 } 421 }
421 } 422 }
422 temp = item; 423 temp = item;
423 item = sel.next(); 424 item = sel.next();
424 mUidDict.remove( inc->uid() ); 425 mUidDict.remove( inc->uid() );
425 delete temp;; 426 delete temp;;
426 addIncidence( inc ); 427 addIncidence( inc );
427 } 428 }
428 topLevelWidget()->setCaption( i18n("Canged alarm for %1 items").arg( count ) ); 429 topLevelWidget()->setCaption( i18n("Canged alarm for %1 items").arg( count ) );
429 qDebug("KO: Set alarm for %d items", count); 430 qDebug("KO: Set alarm for %d items", count);
430 calendar()->reInitAlarmSettings(); 431 calendar()->reInitAlarmSettings();
432 QTimer::singleShot( 1, this, SLOT ( resetFocus() ) );
431} 433}
432void KOListView::setCategories( bool removeOld ) 434void KOListView::setCategories( bool removeOld )
433{ 435{
434 436
435 KPIM::CategorySelectDialog* csd = new KPIM::CategorySelectDialog( KOPrefs::instance(), 0 ); 437 KPIM::CategorySelectDialog* csd = new KPIM::CategorySelectDialog( KOPrefs::instance(), 0 );
436 if (! csd->exec()) { 438 if (! csd->exec()) {
437 delete csd; 439 delete csd;
438 return; 440 return;
439 } 441 }
440 QStringList catList = csd->selectedCategories(); 442 QStringList catList = csd->selectedCategories();
441 delete csd; 443 delete csd;
442 // if ( catList.count() == 0 ) 444 // if ( catList.count() == 0 )
443 // return; 445 // return;
444 catList.sort(); 446 catList.sort();
445 QString categoriesStr = catList.join(","); 447 QString categoriesStr = catList.join(",");
446 int i; 448 int i;
447 QStringList itemList; 449 QStringList itemList;
448 QPtrList<KOListViewItem> sel ; 450 QPtrList<KOListViewItem> sel ;
449 QListViewItem *qitem = mListView->firstChild (); 451 QListViewItem *qitem = mListView->firstChild ();
450 while ( qitem ) { 452 while ( qitem ) {
451 if ( qitem->isSelected() ) { 453 if ( qitem->isSelected() ) {
452 sel.append(((KOListViewItem *)qitem)); 454 sel.append(((KOListViewItem *)qitem));
453 } 455 }
454 qitem = qitem->nextSibling(); 456 qitem = qitem->nextSibling();
455 } 457 }
456 KOListViewItem * item, *temp; 458 KOListViewItem * item, *temp;
457 item = sel.first(); 459 item = sel.first();
458 Incidence* inc; 460 Incidence* inc;
459 while ( item ) { 461 while ( item ) {
460 inc = item->data(); 462 inc = item->data();
461 if ( removeOld ) { 463 if ( removeOld ) {
462 inc->setCategories( categoriesStr ); 464 inc->setCategories( categoriesStr );
463 } else { 465 } else {
464 itemList = QStringList::split (",", inc->categoriesStr() ); 466 itemList = QStringList::split (",", inc->categoriesStr() );
465 for( i = 0; i< catList.count(); ++i ) { 467 for( i = 0; i< catList.count(); ++i ) {
466 if ( !itemList.contains (catList[i])) 468 if ( !itemList.contains (catList[i]))
467 itemList.append( catList[i] ); 469 itemList.append( catList[i] );
468 } 470 }
469 itemList.sort(); 471 itemList.sort();
470 inc->setCategories( itemList.join(",") ); 472 inc->setCategories( itemList.join(",") );
471 } 473 }
472 temp = item; 474 temp = item;
473 item = sel.next(); 475 item = sel.next();
474 mUidDict.remove( inc->uid() ); 476 mUidDict.remove( inc->uid() );
475 delete temp;; 477 delete temp;;
476 addIncidence( inc ); 478 addIncidence( inc );
477 } 479 }
480 QTimer::singleShot( 1, this, SLOT ( resetFocus() ) );
478} 481}
479 482
480void KOListView::beamSelected() 483void KOListView::beamSelected()
481{ 484{
482 int icount = 0; 485 int icount = 0;
483 QPtrList<Incidence> delSel ; 486 QPtrList<Incidence> delSel ;
484 QListViewItem *item = mListView->firstChild (); 487 QListViewItem *item = mListView->firstChild ();
485 while ( item ) { 488 while ( item ) {
486 if ( item->isSelected() ) { 489 if ( item->isSelected() ) {
487 delSel.append(((KOListViewItem *)item)->data()); 490 delSel.append(((KOListViewItem *)item)->data());
488 ++icount; 491 ++icount;
489 } 492 }
490 493
491 item = item->nextSibling(); 494 item = item->nextSibling();
492 } 495 }
493 if ( icount ) { 496 if ( icount ) {
494 emit beamIncidenceList( delSel ); 497 emit beamIncidenceList( delSel );
495 return; 498 return;
496 QString fn ; 499 QString fn ;
497 fn = QDir::homeDirPath()+"/kopitempbeamfile.vcs"; 500 fn = QDir::homeDirPath()+"/kopitempbeamfile.vcs";
498 QString mes; 501 QString mes;
499 bool createbup = true; 502 bool createbup = true;
500 if ( createbup ) { 503 if ( createbup ) {
501 QString description = "\n"; 504 QString description = "\n";
502 CalendarLocal* cal = new CalendarLocal(); 505 CalendarLocal* cal = new CalendarLocal();
503 cal->setTimeZoneId(KPimGlobalPrefs::instance()->mTimeZoneId); 506 cal->setTimeZoneId(KPimGlobalPrefs::instance()->mTimeZoneId);
504 Incidence *incidence = delSel.first(); 507 Incidence *incidence = delSel.first();
505 while ( incidence ) { 508 while ( incidence ) {
506 Incidence *in = incidence->clone(); 509 Incidence *in = incidence->clone();
507 description += in->summary() + "\n"; 510 description += in->summary() + "\n";
508 cal->addIncidence( in ); 511 cal->addIncidence( in );
509 incidence = delSel.next(); 512 incidence = delSel.next();
510 } 513 }
511 FileStorage storage( cal, fn, new VCalFormat ); 514 FileStorage storage( cal, fn, new VCalFormat );
512 storage.save(); 515 storage.save();
513 delete cal; 516 delete cal;
514 mes = i18n("KO/Pi: Ready for beaming"); 517 mes = i18n("KO/Pi: Ready for beaming");
515 topLevelWidget()->setCaption(mes); 518 topLevelWidget()->setCaption(mes);
516 519
517#ifndef DESKTOP_VERSION 520#ifndef DESKTOP_VERSION
518 Ir *ir = new Ir( this ); 521 Ir *ir = new Ir( this );
519 connect( ir, SIGNAL( done( Ir * ) ), this, SLOT( beamDone( Ir * ) ) ); 522 connect( ir, SIGNAL( done( Ir * ) ), this, SLOT( beamDone( Ir * ) ) );
520 ir->send( fn, description, "text/x-vCalendar" ); 523 ir->send( fn, description, "text/x-vCalendar" );
521#endif 524#endif
522 } 525 }
523 } 526 }
524} 527}
525void KOListView::beamDone( Ir *ir ) 528void KOListView::beamDone( Ir *ir )
526{ 529{
527#ifndef DESKTOP_VERSION 530#ifndef DESKTOP_VERSION
528 delete ir; 531 delete ir;
529#endif 532#endif
530 topLevelWidget()->setCaption(i18n("KO/Pi:Beaming done")); 533 topLevelWidget()->setCaption(i18n("KO/Pi:Beaming done"));
531} 534}
532 535
533void KOListView::saveDescriptionToFile() 536void KOListView::saveDescriptionToFile()
534{ 537{
535 538
536 int result = QMessageBox::warning( this, i18n("KO/Pi: Information!"), 539 int result = QMessageBox::warning( this, i18n("KO/Pi: Information!"),
537 i18n("This saves the text/details of selected\nJournals and Events/Todos\nto a text file."), 540 i18n("This saves the text/details of selected\nJournals and Events/Todos\nto a text file."),
538 i18n("Continue"), i18n("Cancel"), 0, 541 i18n("Continue"), i18n("Cancel"), 0,
539 0, 1 ); 542 0, 1 );
540 if ( result != 0 ) { 543 if ( result != 0 ) {
541 return; 544 return;
@@ -638,128 +641,129 @@ void KOListView::writeToFile( bool iCal )
638 journal = true; 641 journal = true;
639 delSel.append(((KOListViewItem *)item)->data()); 642 delSel.append(((KOListViewItem *)item)->data());
640 ++icount; 643 ++icount;
641 } 644 }
642 645
643 item = item->nextSibling(); 646 item = item->nextSibling();
644 } 647 }
645 if ( !iCal && journal ) { 648 if ( !iCal && journal ) {
646 int result = KMessageBox::warningContinueCancel(this, 649 int result = KMessageBox::warningContinueCancel(this,
647 i18n("The journal entries can not be\nexported to a vCalendar file."), 650 i18n("The journal entries can not be\nexported to a vCalendar file."),
648 i18n("Data Loss Warning"),i18n("Proceed"),i18n("Cancel"), 651 i18n("Data Loss Warning"),i18n("Proceed"),i18n("Cancel"),
649 true); 652 true);
650 if (result != KMessageBox::Continue) return; 653 if (result != KMessageBox::Continue) return;
651 } 654 }
652 if ( icount ) { 655 if ( icount ) {
653 QString fn = KOPrefs::instance()->mLastSaveFile; 656 QString fn = KOPrefs::instance()->mLastSaveFile;
654 QString extension; 657 QString extension;
655 if ( iCal ) { 658 if ( iCal ) {
656 if ( fn.right( 4 ).lower() == ".vcs" ) { 659 if ( fn.right( 4 ).lower() == ".vcs" ) {
657 fn = fn.left( fn.length() -3) + "ics"; 660 fn = fn.left( fn.length() -3) + "ics";
658 } 661 }
659 } else { 662 } else {
660 if ( fn.right( 4 ).lower() == ".ics" ) { 663 if ( fn.right( 4 ).lower() == ".ics" ) {
661 fn = fn.left( fn.length() -3) + "vcs"; 664 fn = fn.left( fn.length() -3) + "vcs";
662 } 665 }
663 } 666 }
664 fn = KFileDialog::getSaveFileName( fn, i18n("Save filename"), this ); 667 fn = KFileDialog::getSaveFileName( fn, i18n("Save filename"), this );
665 668
666 if ( fn == "" ) 669 if ( fn == "" )
667 return; 670 return;
668 QFileInfo info; 671 QFileInfo info;
669 info.setFile( fn ); 672 info.setFile( fn );
670 QString mes; 673 QString mes;
671 bool createbup = true; 674 bool createbup = true;
672 if ( info. exists() ) { 675 if ( info. exists() ) {
673 mes = i18n("File already exists!\nOld file from:\n%1\nOverwrite?\n").arg (KGlobal::locale()->formatDateTime(info.lastModified (), true, false ) ); 676 mes = i18n("File already exists!\nOld file from:\n%1\nOverwrite?\n").arg (KGlobal::locale()->formatDateTime(info.lastModified (), true, false ) );
674 int result = QMessageBox::warning( this, i18n("KO/Pi: Warning!"),mes, 677 int result = QMessageBox::warning( this, i18n("KO/Pi: Warning!"),mes,
675 i18n("Overwrite!"), i18n("Cancel"), 0, 678 i18n("Overwrite!"), i18n("Cancel"), 0,
676 0, 1 ); 679 0, 1 );
677 if ( result != 0 ) { 680 if ( result != 0 ) {
678 createbup = false; 681 createbup = false;
679 } 682 }
680 } 683 }
681 if ( createbup ) { 684 if ( createbup ) {
682 CalendarLocal cal; 685 CalendarLocal cal;
683 cal.setTimeZoneId(KPimGlobalPrefs::instance()->mTimeZoneId); 686 cal.setTimeZoneId(KPimGlobalPrefs::instance()->mTimeZoneId);
684 Incidence *incidence = delSel.first(); 687 Incidence *incidence = delSel.first();
685 while ( incidence ) { 688 while ( incidence ) {
686 cal.addIncidence( incidence->clone() ); 689 cal.addIncidence( incidence->clone() );
687 incidence = delSel.next(); 690 incidence = delSel.next();
688 } 691 }
689 if ( iCal ) { 692 if ( iCal ) {
690 ICalFormat format; 693 ICalFormat format;
691 format.save( &cal, fn ); 694 format.save( &cal, fn );
692 } else { 695 } else {
693 696
694 VCalFormat format; 697 VCalFormat format;
695 format.save( &cal, fn ); 698 format.save( &cal, fn );
696 } 699 }
697 mes = i18n("KO/Pi:Saved %1").arg(fn ); 700 mes = i18n("KO/Pi:Saved %1").arg(fn );
698 KOPrefs::instance()->mLastSaveFile = fn; 701 KOPrefs::instance()->mLastSaveFile = fn;
699 topLevelWidget()->setCaption(mes); 702 topLevelWidget()->setCaption(mes);
700 } 703 }
701 } 704 }
705 QTimer::singleShot( 1, this, SLOT ( resetFocus() ) );
702} 706}
703void KOListView::deleteAll() 707void KOListView::deleteAll()
704{ 708{
705 int icount = 0; 709 int icount = 0;
706 QPtrList<Incidence> delSel ; 710 QPtrList<Incidence> delSel ;
707 QListViewItem *item = mListView->firstChild (); 711 QListViewItem *item = mListView->firstChild ();
708 while ( item ) { 712 while ( item ) {
709 if ( item->isSelected() ) { 713 if ( item->isSelected() ) {
710 delSel.append(((KOListViewItem *)item)->data()); 714 delSel.append(((KOListViewItem *)item)->data());
711 ++icount; 715 ++icount;
712 } 716 }
713 717
714 item = item->nextSibling(); 718 item = item->nextSibling();
715 } 719 }
716 if ( icount ) { 720 if ( icount ) {
717 Incidence *incidence = delSel.first(); 721 Incidence *incidence = delSel.first();
718 Incidence *toDelete; 722 Incidence *toDelete;
719 KOPrefs *p = KOPrefs::instance(); 723 KOPrefs *p = KOPrefs::instance();
720 bool confirm = p->mConfirm; 724 bool confirm = p->mConfirm;
721 QString mess; 725 QString mess;
722 mess = mess.sprintf( i18n("You have %d item(s) selected.\n"), icount ); 726 mess = mess.sprintf( i18n("You have %d item(s) selected.\n"), icount );
723 if ( KMessageBox::Continue == KMessageBox::warningContinueCancel(this, mess + i18n("All selected items will be\npermanently deleted.\n(Deleting items will take\nsome time on a PDA)\n"), i18n("KO/Pi Confirmation"),i18n("Delete")) ) { 727 if ( KMessageBox::Continue == KMessageBox::warningContinueCancel(this, mess + i18n("All selected items will be\npermanently deleted.\n(Deleting items will take\nsome time on a PDA)\n"), i18n("KO/Pi Confirmation"),i18n("Delete")) ) {
724 p->mConfirm = false; 728 p->mConfirm = false;
725 int delCounter = 0; 729 int delCounter = 0;
726 QDialog dia ( this, "p-dialog", true ); 730 QDialog dia ( this, "p-dialog", true );
727 QLabel lab (i18n("Close dialog to abort deletion!"), &dia ); 731 QLabel lab (i18n("Close dialog to abort deletion!"), &dia );
728 QVBoxLayout lay( &dia ); 732 QVBoxLayout lay( &dia );
729 lay.setMargin(7); 733 lay.setMargin(7);
730 lay.setSpacing(7); 734 lay.setSpacing(7);
731 lay.addWidget( &lab); 735 lay.addWidget( &lab);
732 QProgressBar bar( icount, &dia ); 736 QProgressBar bar( icount, &dia );
733 lay.addWidget( &bar); 737 lay.addWidget( &bar);
734 int w = 220; 738 int w = 220;
735 int h = 50; 739 int h = 50;
736 int dw = QApplication::desktop()->width(); 740 int dw = QApplication::desktop()->width();
737 int dh = QApplication::desktop()->height(); 741 int dh = QApplication::desktop()->height();
738 dia.setGeometry( (dw-w)/2, (dh - h )/2 ,w,h ); 742 dia.setGeometry( (dw-w)/2, (dh - h )/2 ,w,h );
739 //dia.resize( 240,50 ); 743 //dia.resize( 240,50 );
740 dia.show(); 744 dia.show();
741 745
742 while ( incidence ) { 746 while ( incidence ) {
743 bar.setProgress( delCounter ); 747 bar.setProgress( delCounter );
744 mess = mess.sprintf( i18n("Deleting item %d ..."), ++delCounter ); 748 mess = mess.sprintf( i18n("Deleting item %d ..."), ++delCounter );
745 dia.setCaption( mess ); 749 dia.setCaption( mess );
746 qApp->processEvents(); 750 qApp->processEvents();
747 toDelete = (incidence); 751 toDelete = (incidence);
748 incidence = delSel.next(); 752 incidence = delSel.next();
749 emit deleteIncidenceSignal(toDelete ); 753 emit deleteIncidenceSignal(toDelete );
750 if ( dia.result() != 0 ) 754 if ( dia.result() != 0 )
751 break; 755 break;
752 756
753 } 757 }
754 mess = mess.sprintf( i18n("%d items remaining in list."), count() ); 758 mess = mess.sprintf( i18n("%d items remaining in list."), count() );
755 topLevelWidget ()->setCaption( mess ); 759 topLevelWidget ()->setCaption( mess );
756 p->mConfirm = confirm; 760 p->mConfirm = confirm;
757 } 761 }
758 } 762 }
759 763
760 764
761} 765}
762int KOListView::maxDatesHint() 766int KOListView::maxDatesHint()
763{ 767{
764 return 0; 768 return 0;
765} 769}
@@ -768,130 +772,133 @@ int KOListView::currentDateCount()
768{ 772{
769 return 0; 773 return 0;
770} 774}
771 775
772QPtrList<Incidence> KOListView::selectedIncidences() 776QPtrList<Incidence> KOListView::selectedIncidences()
773{ 777{
774 QPtrList<Incidence> eventList; 778 QPtrList<Incidence> eventList;
775 QListViewItem *item = mListView->firstChild (); 779 QListViewItem *item = mListView->firstChild ();
776 while ( item ) { 780 while ( item ) {
777 if ( item->isSelected() ) { 781 if ( item->isSelected() ) {
778 eventList.append(((KOListViewItem *)item)->data()); 782 eventList.append(((KOListViewItem *)item)->data());
779 } 783 }
780 784
781 item = item->nextSibling(); 785 item = item->nextSibling();
782 } 786 }
783 787
784 // // QListViewItem *item = mListView->selectedItem(); 788 // // QListViewItem *item = mListView->selectedItem();
785 //if (item) eventList.append(((KOListViewItem *)item)->data()); 789 //if (item) eventList.append(((KOListViewItem *)item)->data());
786 790
787 return eventList; 791 return eventList;
788} 792}
789 793
790DateList KOListView::selectedDates() 794DateList KOListView::selectedDates()
791{ 795{
792 DateList eventList; 796 DateList eventList;
793 return eventList; 797 return eventList;
794} 798}
795 799
796void KOListView::showDates(bool show) 800void KOListView::showDates(bool show)
797{ 801{
798 // Shouldn't we set it to a value greater 0? When showDates is called with 802 // Shouldn't we set it to a value greater 0? When showDates is called with
799 // show == true at first, then the columnwidths are set to zero. 803 // show == true at first, then the columnwidths are set to zero.
800 static int oldColWidth1 = 0; 804 static int oldColWidth1 = 0;
801 static int oldColWidth3 = 0; 805 static int oldColWidth3 = 0;
802 806
803 if (!show) { 807 if (!show) {
804 oldColWidth1 = mListView->columnWidth(1); 808 oldColWidth1 = mListView->columnWidth(1);
805 oldColWidth3 = mListView->columnWidth(3); 809 oldColWidth3 = mListView->columnWidth(3);
806 mListView->setColumnWidth(1, 0); 810 mListView->setColumnWidth(1, 0);
807 mListView->setColumnWidth(3, 0); 811 mListView->setColumnWidth(3, 0);
808 } else { 812 } else {
809 mListView->setColumnWidth(1, oldColWidth1); 813 mListView->setColumnWidth(1, oldColWidth1);
810 mListView->setColumnWidth(3, oldColWidth3); 814 mListView->setColumnWidth(3, oldColWidth3);
811 } 815 }
812 mListView->repaint(); 816 mListView->repaint();
813} 817}
814 818
815void KOListView::printPreview(CalPrinter *calPrinter, const QDate &fd, 819void KOListView::printPreview(CalPrinter *calPrinter, const QDate &fd,
816 const QDate &td) 820 const QDate &td)
817{ 821{
818#ifndef KORG_NOPRINTER 822#ifndef KORG_NOPRINTER
819 calPrinter->preview(CalPrinter::Day, fd, td); 823 calPrinter->preview(CalPrinter::Day, fd, td);
820#endif 824#endif
821} 825}
822 826
823void KOListView::showDates() 827void KOListView::showDates()
824{ 828{
825 showDates(true); 829 showDates(true);
826} 830}
827 831
828void KOListView::hideDates() 832void KOListView::hideDates()
829{ 833{
830 showDates(false); 834 showDates(false);
831} 835}
836
832void KOListView::resetFocus() 837void KOListView::resetFocus()
833{ 838{
839 topLevelWidget()->setActiveWindow();
840 topLevelWidget()->raise();
834 mListView->setFocus(); 841 mListView->setFocus();
835} 842}
836void KOListView::updateView() 843void KOListView::updateView()
837{ 844{
838 mListView->setFocus(); 845 mListView->setFocus();
839 if ( mListView->firstChild () ) 846 if ( mListView->firstChild () )
840 mListView->setCurrentItem( mListView->firstChild () ); 847 mListView->setCurrentItem( mListView->firstChild () );
841} 848}
842void KOListView::updateConfig() 849void KOListView::updateConfig()
843{ 850{
844 851
845 mListView->setFont ( KOPrefs::instance()->mListViewFont ); 852 mListView->setFont ( KOPrefs::instance()->mListViewFont );
846 updateView(); 853 updateView();
847 854
848} 855}
849void KOListView::setStartDate(const QDate &start) 856void KOListView::setStartDate(const QDate &start)
850{ 857{
851 mStartDate = start; 858 mStartDate = start;
852} 859}
853 860
854void KOListView::showDates(const QDate &start, const QDate &end) 861void KOListView::showDates(const QDate &start, const QDate &end)
855{ 862{
856 clear(); 863 clear();
857 mStartDate = start; 864 mStartDate = start;
858 QDate date = start; 865 QDate date = start;
859 QPtrList<Journal> j_list; 866 QPtrList<Journal> j_list;
860 while( date <= end ) { 867 while( date <= end ) {
861 addEvents(calendar()->events(date)); 868 addEvents(calendar()->events(date));
862 addTodos(calendar()->todos(date)); 869 addTodos(calendar()->todos(date));
863 Journal* jo = calendar()->journal(date); 870 Journal* jo = calendar()->journal(date);
864 if ( jo ) 871 if ( jo )
865 j_list.append( jo ); 872 j_list.append( jo );
866 date = date.addDays( 1 ); 873 date = date.addDays( 1 );
867 } 874 }
868 addJournals(j_list); 875 addJournals(j_list);
869 emit incidenceSelected( 0 ); 876 emit incidenceSelected( 0 );
870 updateView(); 877 updateView();
871 878
872} 879}
873 880
874void KOListView::addEvents(QPtrList<Event> eventList) 881void KOListView::addEvents(QPtrList<Event> eventList)
875{ 882{
876 Event *ev; 883 Event *ev;
877 for(ev = eventList.first(); ev; ev = eventList.next()) { 884 for(ev = eventList.first(); ev; ev = eventList.next()) {
878 addIncidence(ev); 885 addIncidence(ev);
879 } 886 }
880 if ( !mListView->currentItem() ){ 887 if ( !mListView->currentItem() ){
881 updateView(); 888 updateView();
882 } 889 }
883} 890}
884 891
885void KOListView::addTodos(QPtrList<Todo> eventList) 892void KOListView::addTodos(QPtrList<Todo> eventList)
886{ 893{
887 Todo *ev; 894 Todo *ev;
888 for(ev = eventList.first(); ev; ev = eventList.next()) { 895 for(ev = eventList.first(); ev; ev = eventList.next()) {
889 addIncidence(ev); 896 addIncidence(ev);
890 } 897 }
891 if ( !mListView->currentItem() ){ 898 if ( !mListView->currentItem() ){
892 updateView(); 899 updateView();
893 } 900 }
894} 901}
895void KOListView::addJournals(QPtrList<Journal> eventList) 902void KOListView::addJournals(QPtrList<Journal> eventList)
896{ 903{
897 Journal *ev; 904 Journal *ev;
diff --git a/korganizer/kolistview.h b/korganizer/kolistview.h
index bb0e23e..eb5bb6e 100644
--- a/korganizer/kolistview.h
+++ b/korganizer/kolistview.h
@@ -198,114 +198,114 @@ class ListItemVisitor : public Incidence::Visitor
198 QDate mDate; 198 QDate mDate;
199}; 199};
200 200
201/** 201/**
202 This class provides a multi-column list view of events. It can 202 This class provides a multi-column list view of events. It can
203 display events from one particular day or several days, it doesn't 203 display events from one particular day or several days, it doesn't
204 matter. To use a view that only handles one day at a time, use 204 matter. To use a view that only handles one day at a time, use
205 KODayListView. 205 KODayListView.
206 206
207 @short multi-column list view of various events. 207 @short multi-column list view of various events.
208 @author Preston Brown <pbrown@kde.org> 208 @author Preston Brown <pbrown@kde.org>
209 @see KOBaseView, KODayListView 209 @see KOBaseView, KODayListView
210*/ 210*/
211class KOListView; 211class KOListView;
212 212
213class KOListViewListView : public KListView 213class KOListViewListView : public KListView
214{ 214{
215 Q_OBJECT 215 Q_OBJECT
216 public: 216 public:
217 KOListViewListView(KOListView * lv ); 217 KOListViewListView(KOListView * lv );
218 signals: 218 signals:
219 void newEvent(); 219 void newEvent();
220 void showIncidence( Incidence* ); 220 void showIncidence( Incidence* );
221 public slots: 221 public slots:
222 void popupMenu(); 222 void popupMenu();
223 private: 223 private:
224 QPoint mEventPos; 224 QPoint mEventPos;
225 QPoint mEventGlobalPos; 225 QPoint mEventGlobalPos;
226 QTimer* mPopupTimer; 226 QTimer* mPopupTimer;
227 int mYMousePos; 227 int mYMousePos;
228 void keyPressEvent ( QKeyEvent * ) ; 228 void keyPressEvent ( QKeyEvent * ) ;
229 void contentsMouseDoubleClickEvent(QMouseEvent *e); 229 void contentsMouseDoubleClickEvent(QMouseEvent *e);
230 void contentsMousePressEvent(QMouseEvent *e); 230 void contentsMousePressEvent(QMouseEvent *e);
231 void contentsMouseReleaseEvent(QMouseEvent *e); 231 void contentsMouseReleaseEvent(QMouseEvent *e);
232 void contentsMouseMoveEvent(QMouseEvent *e); 232 void contentsMouseMoveEvent(QMouseEvent *e);
233 bool mMouseDown; 233 bool mMouseDown;
234}; 234};
235 235
236class KOListView : public KOEventView 236class KOListView : public KOEventView
237{ 237{
238 Q_OBJECT 238 Q_OBJECT
239 public: 239 public:
240 KOListView(Calendar *calendar, QWidget *parent = 0, 240 KOListView(Calendar *calendar, QWidget *parent = 0,
241 const char *name = 0); 241 const char *name = 0);
242 ~KOListView(); 242 ~KOListView();
243 243
244 virtual int maxDatesHint(); 244 virtual int maxDatesHint();
245 virtual int currentDateCount(); 245 virtual int currentDateCount();
246 virtual QPtrList<Incidence> selectedIncidences(); 246 virtual QPtrList<Incidence> selectedIncidences();
247 virtual DateList selectedDates(); 247 virtual DateList selectedDates();
248 248
249 void showDates(bool show); 249 void showDates(bool show);
250 Incidence* currentItem(); 250 Incidence* currentItem();
251 void addTodos(QPtrList<Todo> eventList); 251 void addTodos(QPtrList<Todo> eventList);
252 void addJournals(QPtrList<Journal> eventList); 252 void addJournals(QPtrList<Journal> eventList);
253 virtual void printPreview(CalPrinter *calPrinter, 253 virtual void printPreview(CalPrinter *calPrinter,
254 const QDate &, const QDate &); 254 const QDate &, const QDate &);
255 255
256 void readSettings(KConfig *config, QString setting = "KOListView Layout"); 256 void readSettings(KConfig *config, QString setting = "KOListView Layout");
257 void writeSettings(KConfig *config, QString setting = "KOListView Layout"); 257 void writeSettings(KConfig *config, QString setting = "KOListView Layout");
258 void updateList(); 258 void updateList();
259 void setStartDate(const QDate &start); 259 void setStartDate(const QDate &start);
260 int count(); 260 int count();
261 QString getWhatsThisText(QPoint p); 261 QString getWhatsThisText(QPoint p);
262 void resetFocus();
263 signals: 262 signals:
264 void signalNewEvent(); 263 void signalNewEvent();
265 void beamIncidenceList(QPtrList<Incidence>); 264 void beamIncidenceList(QPtrList<Incidence>);
266 265
267 public slots: 266 public slots:
267 void resetFocus();
268 virtual void updateView(); 268 virtual void updateView();
269 virtual void showDates(const QDate &start, const QDate &end); 269 virtual void showDates(const QDate &start, const QDate &end);
270 virtual void showEvents(QPtrList<Event> eventList); 270 virtual void showEvents(QPtrList<Event> eventList);
271 void clearSelection(); 271 void clearSelection();
272 void allSelection(); 272 void allSelection();
273 273
274 void clear(); 274 void clear();
275 void beamDone( Ir *ir ); 275 void beamDone( Ir *ir );
276 void showDates(); 276 void showDates();
277 void hideDates(); 277 void hideDates();
278 void deleteAll(); 278 void deleteAll();
279 void saveToFile(); 279 void saveToFile();
280 void saveToFileVCS(); 280 void saveToFileVCS();
281 void saveDescriptionToFile(); 281 void saveDescriptionToFile();
282 void beamSelected(); 282 void beamSelected();
283 void updateConfig(); 283 void updateConfig();
284 void addCat(); 284 void addCat();
285 void setCat(); 285 void setCat();
286 void setAlarm(); 286 void setAlarm();
287 void setCategories( bool removeOld ); 287 void setCategories( bool removeOld );
288 void changeEventDisplay(Event *, int); 288 void changeEventDisplay(Event *, int);
289 289
290 void defaultItemAction(QListViewItem *item); 290 void defaultItemAction(QListViewItem *item);
291 void popupMenu(QListViewItem *item,const QPoint &,int); 291 void popupMenu(QListViewItem *item,const QPoint &,int);
292 292
293 protected slots: 293 protected slots:
294 void processSelectionChange(QListViewItem *); 294 void processSelectionChange(QListViewItem *);
295 295
296 protected: 296 protected:
297 void writeToFile( bool iCal ); 297 void writeToFile( bool iCal );
298 void addEvents(QPtrList<Event> eventList); 298 void addEvents(QPtrList<Event> eventList);
299 void addIncidence(Incidence *); 299 void addIncidence(Incidence *);
300 KOListViewItem *getItemForEvent(Event *event); 300 KOListViewItem *getItemForEvent(Event *event);
301 301
302 private: 302 private:
303 KOListViewListView *mListView; 303 KOListViewListView *mListView;
304 KOEventPopupMenu *mPopupMenu; 304 KOEventPopupMenu *mPopupMenu;
305 KOListViewItem *mActiveItem; 305 KOListViewItem *mActiveItem;
306 QDict<Incidence> mUidDict; 306 QDict<Incidence> mUidDict;
307 QDate mStartDate; 307 QDate mStartDate;
308 void keyPressEvent ( QKeyEvent * ) ; 308 void keyPressEvent ( QKeyEvent * ) ;
309}; 309};
310 310
311#endif 311#endif
diff --git a/korganizer/komonthview.cpp b/korganizer/komonthview.cpp
index 2b7e41f..843526d 100644
--- a/korganizer/komonthview.cpp
+++ b/korganizer/komonthview.cpp
@@ -226,151 +226,147 @@ void KNoScrollListBox::keyPressEvent(QKeyEvent *e)
226 } 226 }
227 } 227 }
228 break; 228 break;
229 case Key_Shift: 229 case Key_Shift:
230 emit shiftDown(); 230 emit shiftDown();
231 break; 231 break;
232 default: 232 default:
233 e->ignore(); 233 e->ignore();
234 break; 234 break;
235 } 235 }
236} 236}
237 237
238void KNoScrollListBox::oneDown() 238void KNoScrollListBox::oneDown()
239{ 239{
240 if ( count () ) { 240 if ( count () ) {
241 if ( currentItem()+1 == count () ) { 241 if ( currentItem()+1 == count () ) {
242 emit nextCell(); 242 emit nextCell();
243 } else { 243 } else {
244 resetOnFocusIn = false; 244 resetOnFocusIn = false;
245 setCurrentItem((currentItem()+1)%count()); 245 setCurrentItem((currentItem()+1)%count());
246 if(!itemVisible(currentItem())) { 246 if(!itemVisible(currentItem())) {
247 if(currentItem() == 0) { 247 if(currentItem() == 0) {
248 setTopItem(0); 248 setTopItem(0);
249 } else { 249 } else {
250 setTopItem(topItem()+1); 250 setTopItem(topItem()+1);
251 } 251 }
252 } 252 }
253 } 253 }
254 } 254 }
255} 255}
256void KNoScrollListBox::keyReleaseEvent(QKeyEvent *e) 256void KNoScrollListBox::keyReleaseEvent(QKeyEvent *e)
257{ 257{
258 switch(e->key()) { 258 switch(e->key()) {
259 case Key_Shift: 259 case Key_Shift:
260 emit shiftUp(); 260 emit shiftUp();
261 break; 261 break;
262 default: 262 default:
263 break; 263 break;
264 } 264 }
265} 265}
266 266
267void KNoScrollListBox::mousePressEvent(QMouseEvent *e) 267void KNoScrollListBox::mousePressEvent(QMouseEvent *e)
268{ 268{
269 QListBox::mousePressEvent(e); 269 QListBox::mousePressEvent(e);
270 270
271 if(e->button() == RightButton) { 271 if(e->button() == RightButton) {
272 emit rightClick(); 272 emit rightClick();
273 } 273 }
274} 274}
275 275
276MonthViewItem::MonthViewItem( Incidence *incidence, QDate qd, const QString & s) 276MonthViewItem::MonthViewItem( Incidence *incidence, QDate qd, const QString & s)
277 : QListBoxItem() 277 : QListBoxItem()
278{ 278{
279 mblockRepaint = true; 279 mblockRepaint = true;
280 setText( s ); 280 setText( s );
281 mMultiday = 0; 281 mMultiday = 0;
282 mIncidence = incidence; 282 mIncidence = incidence;
283 mDate = qd; 283 mDate = qd;
284 mRecur = false; 284 mRecur = false;
285 mAlarm = false; 285 mAlarm = false;
286 mReply = false; 286 mReply = false;
287 mInfo = false; 287 mInfo = false;
288 mdayPos = 0; 288 mdayPos = 0;
289 isWeekItem = KOPrefs::instance()->mMonthViewWeek; 289 isWeekItem = KOPrefs::instance()->mMonthViewWeek;
290 //qDebug("NEWWWWWWWWWWWWW ");
291} 290}
292void MonthViewItem::recycle( Incidence *incidence, QDate qd, const QString & s) 291void MonthViewItem::recycle( Incidence *incidence, QDate qd, const QString & s)
293{ 292{
294 setText( s ); 293 setText( s );
295 mMultiday = 0; 294 mMultiday = 0;
296 mIncidence = incidence; 295 mIncidence = incidence;
297 mDate = qd; 296 mDate = qd;
298 mRecur = false; 297 mRecur = false;
299 mAlarm = false; 298 mAlarm = false;
300 mReply = false; 299 mReply = false;
301 mInfo = false; 300 mInfo = false;
302 mdayPos = 0; 301 mdayPos = 0;
303 //qDebug("recucleeeeeeeeeeeeeeeee ");
304} 302}
305 303
306void MonthViewItem::paint(QPainter *p) 304void MonthViewItem::paint(QPainter *p)
307{ 305{
308 if ( mblockRepaint ) { 306 if ( mblockRepaint ) {
309 //qDebug("block ");
310 return; 307 return;
311 } 308 }
312 //qDebug("NON block ");
313#if QT_VERSION >= 0x030000 309#if QT_VERSION >= 0x030000
314 bool sel = isSelected(); 310 bool sel = isSelected();
315#else 311#else
316 bool sel = selected(); 312 bool sel = selected();
317#endif 313#endif
318 314
319 315
320 if (KOPrefs::instance()->mMonthViewUsesCategoryColor) 316 if (KOPrefs::instance()->mMonthViewUsesCategoryColor)
321 { 317 {
322 p->setBackgroundColor( palette().color( QPalette::Normal, \ 318 p->setBackgroundColor( palette().color( QPalette::Normal, \
323 sel ? QColorGroup::Highlight : QColorGroup::Background ) ); 319 sel ? QColorGroup::Highlight : QColorGroup::Background ) );
324 p->eraseRect( 0, 0, listBox()->maxItemWidth(), height( listBox() ) ); 320 p->eraseRect( 0, 0, listBox()->maxItemWidth(), height( listBox() ) );
325 } 321 }
326 int x = 1; 322 int x = 1;
327 //int y = 3;//(height() - mRecurPixmap.height()) /2; 323 //int y = 3;//(height() - mRecurPixmap.height()) /2;
328 int size = PIXMAP_SIZE; 324 int size = PIXMAP_SIZE;
329 if ( QApplication::desktop()->width() < 300 ) 325 if ( QApplication::desktop()->width() < 300 )
330 size = 3; 326 size = 3;
331 int heihei = height( listBox () ); 327 int heihei = height( listBox () );
332 int y = (heihei - size -1 ) /2; 328 int y = (heihei - size -1 ) /2;
333 329
334 if ( KOPrefs::instance()->mMonthShowIcons ) { 330 if ( KOPrefs::instance()->mMonthShowIcons ) {
335 if ( mInfo ) { 331 if ( mInfo ) {
336 p->fillRect ( x, y,size,size, Qt::darkGreen ); 332 p->fillRect ( x, y,size,size, Qt::darkGreen );
337 x += size + 1; 333 x += size + 1;
338 } 334 }
339 if ( mRecur ) { 335 if ( mRecur ) {
340 p->fillRect ( x, y,size,size, Qt::blue ); 336 p->fillRect ( x, y,size,size, Qt::blue );
341 x += size + 1; 337 x += size + 1;
342 } 338 }
343 if ( mAlarm ) { 339 if ( mAlarm ) {
344 p->fillRect ( x, y,size,size, Qt::red ); 340 p->fillRect ( x, y,size,size, Qt::red );
345 x += size + 1; 341 x += size + 1;
346 } 342 }
347 if ( mReply ) { 343 if ( mReply ) {
348 p->fillRect ( x, y,size,size, Qt::yellow ); 344 p->fillRect ( x, y,size,size, Qt::yellow );
349 x += size + 1; 345 x += size + 1;
350 } 346 }
351 } 347 }
352 if ( mMultiday ) { 348 if ( mMultiday ) {
353 int yyy = y+(size/2); 349 int yyy = y+(size/2);
354 int sizeM = size+2; 350 int sizeM = size+2;
355 p->setBrush( QBrush::SolidPattern ); 351 p->setBrush( QBrush::SolidPattern );
356 p->drawLine ( x+1, yyy, x +sizeM +sizeM/2-1, yyy ) ; 352 p->drawLine ( x+1, yyy, x +sizeM +sizeM/2-1, yyy ) ;
357 if ( mMultiday == 2 || mMultiday == 3 ) { 353 if ( mMultiday == 2 || mMultiday == 3 ) {
358 QPointArray pa ( 3 ); 354 QPointArray pa ( 3 );
359 pa.setPoint (0, x, yyy ); 355 pa.setPoint (0, x, yyy );
360 pa.setPoint (1, x+sizeM/2, yyy+sizeM/2 ); 356 pa.setPoint (1, x+sizeM/2, yyy+sizeM/2 );
361 pa.setPoint (2, x+sizeM/2, yyy-sizeM/2 ); 357 pa.setPoint (2, x+sizeM/2, yyy-sizeM/2 );
362 p->drawPolygon( pa ); 358 p->drawPolygon( pa );
363 } 359 }
364 if ( mMultiday == 2 || mMultiday == 1 ) { 360 if ( mMultiday == 2 || mMultiday == 1 ) {
365 QPointArray pa ( 3 ); 361 QPointArray pa ( 3 );
366 pa.setPoint (0, x+sizeM +sizeM/2, yyy ); 362 pa.setPoint (0, x+sizeM +sizeM/2, yyy );
367 pa.setPoint (1, x+sizeM, yyy+sizeM/2 ); 363 pa.setPoint (1, x+sizeM, yyy+sizeM/2 );
368 pa.setPoint (2, x+sizeM, yyy-sizeM/2 ); 364 pa.setPoint (2, x+sizeM, yyy-sizeM/2 );
369 p->drawPolygon( pa ); 365 p->drawPolygon( pa );
370 } 366 }
371 if ( mMultiday == 1 ) { 367 if ( mMultiday == 1 ) {
372 // p->fillRect ( x, yyy-sizeM/2+1, sizeM/2, size, QBrush ( QBrush::SolidPattern ) ); 368 // p->fillRect ( x, yyy-sizeM/2+1, sizeM/2, size, QBrush ( QBrush::SolidPattern ) );
373 369
374 p->drawLine ( x+1, yyy-sizeM/2, x+1, yyy+sizeM/2 ); 370 p->drawLine ( x+1, yyy-sizeM/2, x+1, yyy+sizeM/2 );
375 } 371 }
376 if ( mMultiday == 3 ) { 372 if ( mMultiday == 3 ) {
@@ -399,129 +395,128 @@ void MonthViewItem::paint(QPainter *p)
399 } 395 }
400 QFontMetrics fm = p->fontMetrics(); 396 QFontMetrics fm = p->fontMetrics();
401 int yPos; 397 int yPos;
402 int pmheight = size; 398 int pmheight = size;
403 if( pmheight < fm.height() ) 399 if( pmheight < fm.height() )
404 yPos = fm.ascent() + fm.leading()/2; 400 yPos = fm.ascent() + fm.leading()/2;
405 else 401 else
406 yPos = pmheight/2 - fm.height()/2 + fm.ascent(); 402 yPos = pmheight/2 - fm.height()/2 + fm.ascent();
407 p->setPen( palette().color( QPalette::Normal, sel ? \ 403 p->setPen( palette().color( QPalette::Normal, sel ? \
408 QColorGroup::HighlightedText : QColorGroup::Foreground ) ); 404 QColorGroup::HighlightedText : QColorGroup::Foreground ) );
409 if ( KOPrefs::instance()->mMonthShowTimes || isWeekItem) { 405 if ( KOPrefs::instance()->mMonthShowTimes || isWeekItem) {
410 p->drawText( x, yPos, text() ); 406 p->drawText( x, yPos, text() );
411 if ( mIncidence->cancelled() ) { 407 if ( mIncidence->cancelled() ) {
412 int wid = fm.width( text() ); 408 int wid = fm.width( text() );
413 p->drawLine( x, heihei/2 ,x+wid, heihei/2 ); 409 p->drawLine( x, heihei/2 ,x+wid, heihei/2 );
414 } 410 }
415 } else { 411 } else {
416 QString pText = text(); 412 QString pText = text();
417 if( pText.mid(2,1) == ":" ) 413 if( pText.mid(2,1) == ":" )
418 pText = pText.mid( 6 ); 414 pText = pText.mid( 6 );
419 p->drawText( x, yPos, pText ); 415 p->drawText( x, yPos, pText );
420 if ( mIncidence->cancelled() ) { 416 if ( mIncidence->cancelled() ) {
421 int wid = fm.width( pText ); 417 int wid = fm.width( pText );
422 p->drawLine( x, heihei/2 ,x+wid, heihei/2 ); 418 p->drawLine( x, heihei/2 ,x+wid, heihei/2 );
423 } 419 }
424 } 420 }
425} 421}
426 422
427int MonthViewItem::height(const QListBox *lb) const 423int MonthViewItem::height(const QListBox *lb) const
428{ 424{
429 int ret = 10; 425 int ret = 10;
430 if ( lb ) 426 if ( lb )
431 ret = lb->fontMetrics().lineSpacing()+1; 427 ret = lb->fontMetrics().lineSpacing()+1;
432 return ret; 428 return ret;
433} 429}
434 430
435int MonthViewItem::width(const QListBox *lb) const 431int MonthViewItem::width(const QListBox *lb) const
436{ 432{
437 if( KOPrefs::instance()->mEnableMonthScroll || isWeekItem ) { 433 if( KOPrefs::instance()->mEnableMonthScroll || isWeekItem ) {
438 int size = PIXMAP_SIZE; 434 int size = PIXMAP_SIZE;
439 if ( QApplication::desktop()->width() < 300 ) 435 if ( QApplication::desktop()->width() < 300 )
440 size = 3; 436 size = 3;
441 int x = 1; 437 int x = 1;
442 if ( KOPrefs::instance()->mMonthShowIcons ) { 438 if ( KOPrefs::instance()->mMonthShowIcons ) {
443 if ( mInfo ) { 439 if ( mInfo ) {
444 x += size + 1; 440 x += size + 1;
445 } 441 }
446 if( mRecur ) { 442 if( mRecur ) {
447 x += size+1; 443 x += size+1;
448 } 444 }
449 if( mAlarm ) { 445 if( mAlarm ) {
450 x += size+1; 446 x += size+1;
451 } 447 }
452 if( mReply ) { 448 if( mReply ) {
453 x += size+1; 449 x += size+1;
454 } 450 }
455 } 451 }
456 if( mMultiday ) { 452 if( mMultiday ) {
457 x += size+1+2+size/2; 453 x += size+1+2+size/2;
458 } 454 }
459 return( x + lb->fontMetrics().width( text() ) + 1 ); 455 return( x + lb->fontMetrics().width( text() ) + 1 );
460 } 456 }
461 if ( ! lb ) 457 if ( ! lb )
462 return 10; 458 return 10;
463 //qDebug("ret wid %d ", lb->width());
464 return lb->width(); 459 return lb->width();
465} 460}
466 461
467 462
468MonthViewCell::MonthViewCell( KOMonthView *parent,QWidget* par ) 463MonthViewCell::MonthViewCell( KOMonthView *parent,QWidget* par )
469 : KNoScrollListBox( par ), 464 : KNoScrollListBox( par ),
470 mMonthView( parent ) 465 mMonthView( parent )
471{ 466{
472 //QVBoxLayout *topLayout = new QVBoxLayout( this ); 467 //QVBoxLayout *topLayout = new QVBoxLayout( this );
473 currentPalette = 0; 468 currentPalette = 0;
474 // mLabel = new QLabel( this );QPushButton 469 // mLabel = new QLabel( this );QPushButton
475 mLabel = new QPushButton( this ); 470 mLabel = new QPushButton( this );
476 //mLabel->setFrameStyle( QFrame::Panel | QFrame::Plain ); 471 //mLabel->setFrameStyle( QFrame::Panel | QFrame::Plain );
477 //mLabel->setLineWidth( 1 ); 472 //mLabel->setLineWidth( 1 );
478 //mLabel->setAlignment( AlignCenter ); 473 //mLabel->setAlignment( AlignCenter );
479 mLabel->setFlat( true ); 474 mLabel->setFlat( true );
480 mLabel->setFocusPolicy(NoFocus); 475 mLabel->setFocusPolicy(NoFocus);
481 //mItemList = new KNoScrollListBox( this ); 476 //mItemList = new KNoScrollListBox( this );
482 setMinimumSize( 10, 10 ); 477 setMinimumSize( 10, 10 );
483 setFrameStyle( QFrame::Panel | QFrame::Plain ); 478 setFrameStyle( QFrame::Panel | QFrame::Plain );
484 setLineWidth( 1 ); 479 setLineWidth( 1 );
485 //topLayout->addWidget( mItemList ); 480 //topLayout->addWidget( mItemList );
486 mLabel->raise(); 481 mLabel->raise();
487 // QColor( 0,0,255 ) QColor( 160,1600,255 ) 482 // QColor( 0,0,255 ) QColor( 160,1600,255 )
488 mStandardPalette = palette(); 483 mStandardPalette = palette();
489 mStandardPalette.setColor(QColorGroup::Base, mStandardPalette.color( QPalette::Normal, QColorGroup::Background ) ); 484 mStandardPalette.setColor(QColorGroup::Base, mStandardPalette.color( QPalette::Normal, QColorGroup::Background ) );
490 485
491 enableScrollBars( false ); 486 enableScrollBars( false );
492 updateConfig(); 487 updateConfig();
493 //connect( mLabel, SIGNAL( clicked( )), SLOT( newEvent() )); 488 //connect( mLabel, SIGNAL( clicked( )), SLOT( newEvent() ));
494 connect( mLabel, SIGNAL( clicked( )), SLOT( showDay() )); 489 connect( mLabel, SIGNAL( clicked( )), SLOT( showDay() ));
495 connect( this , SIGNAL( doubleClicked( QListBoxItem *) ), 490 connect( this , SIGNAL( doubleClicked( QListBoxItem *) ),
496 SLOT( defaultAction( QListBoxItem * ) ) ); 491 SLOT( defaultAction( QListBoxItem * ) ) );
497 connect( this, SIGNAL( rightButtonPressed( QListBoxItem *, 492 connect( this, SIGNAL( rightButtonPressed( QListBoxItem *,
498 const QPoint &) ), 493 const QPoint &) ),
499 SLOT( contextMenu( QListBoxItem * ) ) ); 494 SLOT( contextMenu( QListBoxItem * ) ) );
500 connect( this, SIGNAL( highlighted( QListBoxItem *) ), 495 connect( this, SIGNAL( highlighted( QListBoxItem *) ),
501 SLOT( selection( QListBoxItem * ) ) ); 496 SLOT( selection( QListBoxItem * ) ) );
502 497
503 /* 498 /*
504 connect( this, SIGNAL( clicked( QListBoxItem * ) ), 499 connect( this, SIGNAL( clicked( QListBoxItem * ) ),
505 SLOT( selection( QListBoxItem * ) ) ); 500 SLOT( selection( QListBoxItem * ) ) );
506 */ 501 */
507} 502}
508#ifdef DESKTOP_VERSION 503#ifdef DESKTOP_VERSION
509QToolTipGroup *MonthViewCell::toolTipGroup() 504QToolTipGroup *MonthViewCell::toolTipGroup()
510{ 505{
511 if (!mToolTipGroup) mToolTipGroup = new QToolTipGroup(0); 506 if (!mToolTipGroup) mToolTipGroup = new QToolTipGroup(0);
512 return mToolTipGroup; 507 return mToolTipGroup;
513} 508}
514#endif 509#endif
515 510
516void MonthViewCell::setDate( const QDate &date ) 511void MonthViewCell::setDate( const QDate &date )
517{ 512{
518 // kdDebug() << "MonthViewCell::setDate(): " << date.toString() << endl; 513 // kdDebug() << "MonthViewCell::setDate(): " << date.toString() << endl;
519 mDate = date; 514 mDate = date;
520 515
521 516
522 517
523 //resizeEvent( 0 ); 518 //resizeEvent( 0 );
524} 519}
525 520
526QDate MonthViewCell::date() const 521QDate MonthViewCell::date() const
527{ 522{
@@ -551,134 +546,129 @@ void MonthViewCell::setMyPalette()
551 setPalette( mPrimaryPalette ); 546 setPalette( mPrimaryPalette );
552 currentPalette = 2; 547 currentPalette = 2;
553 548
554 } else { 549 } else {
555 if ( currentPalette == 3 ) return; 550 if ( currentPalette == 3 ) return;
556 setPalette( mNonPrimaryPalette ); 551 setPalette( mNonPrimaryPalette );
557 mLabel->setPalette( QPalette ( mNonPrimaryPalette.color( QPalette::Normal,QColorGroup::Base),mNonPrimaryPalette.color(QPalette::Normal,QColorGroup::Base ) )); 552 mLabel->setPalette( QPalette ( mNonPrimaryPalette.color( QPalette::Normal,QColorGroup::Base),mNonPrimaryPalette.color(QPalette::Normal,QColorGroup::Base ) ));
558 //mLabel->setPalette( mNonPrimaryPalette );; 553 //mLabel->setPalette( mNonPrimaryPalette );;
559 currentPalette = 3; 554 currentPalette = 3;
560 } 555 }
561 } 556 }
562 //QPalette pal = palette(); 557 //QPalette pal = palette();
563 558
564 //mLabel->setPalette( QPalette ( pal.color( QPalette::Normal,QColorGroup::Base),pal.color(QPalette::Normal,QColorGroup::Base ) )); 559 //mLabel->setPalette( QPalette ( pal.color( QPalette::Normal,QColorGroup::Base),pal.color(QPalette::Normal,QColorGroup::Base ) ));
565} 560}
566QPalette MonthViewCell::getPalette () 561QPalette MonthViewCell::getPalette ()
567{ 562{
568 if ( !KOPrefs::instance()->mMonthViewUsesDayColors ) 563 if ( !KOPrefs::instance()->mMonthViewUsesDayColors )
569 return mStandardPalette; 564 return mStandardPalette;
570 if ( mHoliday) { 565 if ( mHoliday) {
571 return mHolidayPalette ; 566 return mHolidayPalette ;
572 } else { 567 } else {
573 if ( mPrimary ) { 568 if ( mPrimary ) {
574 return mPrimaryPalette ; 569 return mPrimaryPalette ;
575 } 570 }
576 } 571 }
577 return mNonPrimaryPalette; 572 return mNonPrimaryPalette;
578} 573}
579bool MonthViewCell::isPrimary() const 574bool MonthViewCell::isPrimary() const
580{ 575{
581 return mPrimary; 576 return mPrimary;
582} 577}
583 578
584void MonthViewCell::setHoliday( bool holiday ) 579void MonthViewCell::setHoliday( bool holiday )
585{ 580{
586 mHoliday = holiday; 581 mHoliday = holiday;
587 //setMyPalette(); 582 //setMyPalette();
588} 583}
589 584
590void MonthViewCell::setHoliday( const QString &holiday ) 585void MonthViewCell::setHoliday( const QString &holiday )
591{ 586{
592 mHolidayString = holiday; 587 mHolidayString = holiday;
593 588
594 if ( !holiday.isEmpty() ) { 589 if ( !holiday.isEmpty() ) {
595 setHoliday( true ); 590 setHoliday( true );
596 } 591 }
597} 592}
598 593
599void MonthViewCell::startUpdateCell() 594void MonthViewCell::startUpdateCell()
600{ 595{
601 mdayCount = 0; 596 mdayCount = 0;
602 setFocusPolicy(NoFocus); 597 setFocusPolicy(NoFocus);
603 if ( !mMonthView->isUpdatePossible() ) 598 if ( !mMonthView->isUpdatePossible() )
604 return; 599 return;
605 MonthViewItem *mitem = (MonthViewItem*) firstItem (); 600 MonthViewItem *mitem = (MonthViewItem*) firstItem ();
606 while ( mitem ) { 601 while ( mitem ) {
607 mitem->setBlockRepaint( true ); 602 mitem->setBlockRepaint( true );
608 mitem = (MonthViewItem *)mitem->next(); 603 mitem = (MonthViewItem *)mitem->next();
609 } 604 }
610 if ( mAvailItemList.count() > 20 ) { 605 if ( mAvailItemList.count() > 20 ) {
611 mAvailItemList.setAutoDelete( true ); 606 mAvailItemList.setAutoDelete( true );
612 mAvailItemList.clear(); 607 mAvailItemList.clear();
613 mAvailItemList.setAutoDelete( false ); 608 mAvailItemList.setAutoDelete( false );
614 } 609 }
615 /* 610
616 if ( !isVisible() ){
617 return;
618 }
619 */
620 // qDebug("MonthViewCell::updateCell() ");
621 setPrimary( mDate.month()%2 ); 611 setPrimary( mDate.month()%2 );
622 setHoliday( KOGlobals::self()->calendarSystem()->dayOfWeek(mDate) == KOGlobals::self()->calendarSystem()->weekDayOfPray() || ( mDate.dayOfWeek() == 6 ) && KOPrefs::instance()-> mExcludeSaturdays); 612 setHoliday( KOGlobals::self()->calendarSystem()->dayOfWeek(mDate) == KOGlobals::self()->calendarSystem()->weekDayOfPray() || ( mDate.dayOfWeek() == 6 ) && KOPrefs::instance()-> mExcludeSaturdays);
623 if ( mDate == QDate::currentDate() ) { 613 if ( mDate == QDate::currentDate() ) {
624 setLineWidth( 3 ); 614 setLineWidth( 3 );
625 } else { 615 } else {
626 setLineWidth( 1 ); 616 setLineWidth( 1 );
627 } 617 }
628 MonthViewItem* CurrentAvailItem = (MonthViewItem*) firstItem (); 618 MonthViewItem* CurrentAvailItem = (MonthViewItem*) firstItem ();
629 //clear(); 619 //clear();
630 while ( CurrentAvailItem ) { 620 while ( CurrentAvailItem ) {
631 MonthViewItem *item = CurrentAvailItem; 621 MonthViewItem *item = CurrentAvailItem;
632 CurrentAvailItem = (MonthViewItem *)item->next(); 622 CurrentAvailItem = (MonthViewItem *)item->next();
633 mAvailItemList.append( item ); 623 mAvailItemList.append( item );
634 takeItem ( item ); 624 takeItem ( item );
635 } 625 }
636 626
637#ifdef DESKTOP_VERSION 627#ifdef DESKTOP_VERSION
638 QToolTip::remove(this); 628 QToolTip::remove(this);
639#endif 629#endif
640 mToolTip.clear(); 630 mToolTip.clear();
641 //qApp->processEvents(); 631 //qApp->processEvents();
642#if 0 632#if 0
643 if ( !mHolidayString.isEmpty() ) { 633 if ( !mHolidayString.isEmpty() ) {
644 MonthViewItem *item = new MonthViewItem( 0, mDate, mHolidayString ); 634 MonthViewItem *item = new MonthViewItem( 0, mDate, mHolidayString );
645 item->setPalette( mHolidayPalette ); 635 item->setPalette( mHolidayPalette );
646 insertItem( item ); 636 insertItem( item );
647 mToolTip.append ( mHolidayString ); 637 mToolTip.append ( mHolidayString );
648 } 638 }
649#endif 639#endif
650} 640}
651 641
652int MonthViewCell::insertEvent(Event *event) 642int MonthViewCell::insertEvent(Event *event)
653{ 643{
654 bool useToolTips = true; 644 bool useToolTips = true;
655#ifndef DESKTOP_VERSION 645#ifndef DESKTOP_VERSION
656 useToolTips = false; 646 useToolTips = false;
657#endif 647#endif
658 QString mToolTipText; 648 QString mToolTipText;
659 setFocusPolicy(WheelFocus); 649 setFocusPolicy(WheelFocus);
660 if ( !(event->doesRecur() == Recurrence::rNone) ) { 650 if ( !(event->doesRecur() == Recurrence::rNone) ) {
661 if ( !KOPrefs::instance()->mMonthDailyRecur && event->doesRecur() == Recurrence::rDaily ) 651 if ( !KOPrefs::instance()->mMonthDailyRecur && event->doesRecur() == Recurrence::rDaily )
662 return mdayCount; 652 return mdayCount;
663 else 653 else
664 if ( !KOPrefs::instance()->mMonthWeeklyRecur && event->doesRecur() == Recurrence::rWeekly ) 654 if ( !KOPrefs::instance()->mMonthWeeklyRecur && event->doesRecur() == Recurrence::rWeekly )
665 return mdayCount; 655 return mdayCount;
666 } 656 }
667 657
668 if ( event->isHoliday()) { 658 if ( event->isHoliday()) {
669 setHoliday( true ); 659 setHoliday( true );
670 if ( mDate.dayOfWeek() == 7 ) 660 if ( mDate.dayOfWeek() == 7 )
671 setLineWidth( 3 ); 661 setLineWidth( 3 );
672 } 662 }
673 QString text; 663 QString text;
674 int multiday = 0;// 1 = start, 2 = midddle, 3 = end day 664 int multiday = 0;// 1 = start, 2 = midddle, 3 = end day
675 if (event->isMultiDay()) { 665 if (event->isMultiDay()) {
676 QString prefix = "<->";multiday = 2; 666 QString prefix = "<->";multiday = 2;
677 QString time; 667 QString time;
678 if ( event->doesRecur() ) { 668 if ( event->doesRecur() ) {
679 if ( event->recursOn( mDate) ) { 669 if ( event->recursOn( mDate) ) {
680 prefix ="->" ;multiday = 1; 670 prefix ="->" ;multiday = 1;
681 } 671 }
682 else { 672 else {
683 int days = event->dtStart().date().daysTo ( event->dtEnd().date() ); 673 int days = event->dtStart().date().daysTo ( event->dtEnd().date() );
684 if ( event->recursOn( mDate.addDays( -days)) ) { 674 if ( event->recursOn( mDate.addDays( -days)) ) {
@@ -810,129 +800,128 @@ void MonthViewCell::insertTodo(Todo *todo)
810 } 800 }
811 //MonthViewItem *item = new MonthViewItem( todo, mDate, text ); 801 //MonthViewItem *item = new MonthViewItem( todo, mDate, text );
812 //item->setPalette( mStandardPalette ); 802 //item->setPalette( mStandardPalette );
813 QPalette pal; 803 QPalette pal;
814 if (KOPrefs::instance()->mMonthViewUsesCategoryColor) { 804 if (KOPrefs::instance()->mMonthViewUsesCategoryColor) {
815 QStringList categories = todo->categories(); 805 QStringList categories = todo->categories();
816 QString cat = categories.first(); 806 QString cat = categories.first();
817 if ( KOPrefs::instance()->mMonthViewUsesForegroundColor ) { 807 if ( KOPrefs::instance()->mMonthViewUsesForegroundColor ) {
818 pal = getPalette(); 808 pal = getPalette();
819 if (cat.isEmpty()) { 809 if (cat.isEmpty()) {
820 pal.setColor(QColorGroup::Foreground,KOPrefs::instance()->mEventColor); 810 pal.setColor(QColorGroup::Foreground,KOPrefs::instance()->mEventColor);
821 } else { 811 } else {
822 pal.setColor(QColorGroup::Foreground, *(KOPrefs::instance()->categoryColor(cat))); 812 pal.setColor(QColorGroup::Foreground, *(KOPrefs::instance()->categoryColor(cat)));
823 } 813 }
824 814
825 } else { 815 } else {
826 if (cat.isEmpty()) { 816 if (cat.isEmpty()) {
827 pal = QPalette(KOPrefs::instance()->mEventColor, KOPrefs::instance()->mEventColor); 817 pal = QPalette(KOPrefs::instance()->mEventColor, KOPrefs::instance()->mEventColor);
828 } else { 818 } else {
829 pal = QPalette(*(KOPrefs::instance()->categoryColor(cat)), *(KOPrefs::instance()->categoryColor(cat))); 819 pal = QPalette(*(KOPrefs::instance()->categoryColor(cat)), *(KOPrefs::instance()->categoryColor(cat)));
830 } 820 }
831 } 821 }
832 822
833 } else { 823 } else {
834 pal = mStandardPalette ; 824 pal = mStandardPalette ;
835 } 825 }
836 item->setPalette( pal ); 826 item->setPalette( pal );
837 item->setRecur( todo->recurrence()->doesRecur() ); 827 item->setRecur( todo->recurrence()->doesRecur() );
838 item->setAlarm( todo->isAlarmEnabled() ); 828 item->setAlarm( todo->isAlarmEnabled() );
839 item->setMoreInfo( todo->description().length() > 0 ); 829 item->setMoreInfo( todo->description().length() > 0 );
840 insertItem( item , count()); 830 insertItem( item , count());
841#ifdef DESKTOP_VERSION 831#ifdef DESKTOP_VERSION
842 mToolTip.append( text ); 832 mToolTip.append( text );
843#endif 833#endif
844} 834}
845void MonthViewCell::repaintfinishUpdateCell() 835void MonthViewCell::repaintfinishUpdateCell()
846{ 836{
847 MonthViewItem *mitem = (MonthViewItem*) firstItem (); 837 MonthViewItem *mitem = (MonthViewItem*) firstItem ();
848 while ( mitem ) { 838 while ( mitem ) {
849 mitem->setBlockRepaint( false ); 839 mitem->setBlockRepaint( false );
850 updateItem ( mitem ); 840 updateItem ( mitem );
851 mitem = (MonthViewItem *)mitem->next(); 841 mitem = (MonthViewItem *)mitem->next();
852 } 842 }
853} 843}
854void MonthViewCell::finishUpdateCell() 844void MonthViewCell::finishUpdateCell()
855{ 845{
856 846
857 847
858 848
859#ifdef DESKTOP_VERSION 849#ifdef DESKTOP_VERSION
860 if (mToolTip.count() > 0 ) { 850 if (mToolTip.count() > 0 ) {
861 mToolTip.sort(); 851 mToolTip.sort();
862 QToolTip::add(this,mToolTip.join("\n"),toolTipGroup(),""); 852 QToolTip::add(this,mToolTip.join("\n"),toolTipGroup(),"");
863 } 853 }
864#endif 854#endif
865 //sort(); 855 //sort();
866 //setMyPalette(); 856 //setMyPalette();
867 setMyPalette(); 857 setMyPalette();
868 858
869 resizeEvent( 0 ); 859 resizeEvent( 0 );
870 860
871} 861}
872void MonthViewCell::updateCell() 862void MonthViewCell::updateCell()
873{ 863{
874 //qDebug("MonthViewCell::updateCell() ");
875 if ( !mMonthView->isUpdatePossible() ) 864 if ( !mMonthView->isUpdatePossible() )
876 return; 865 return;
877 startUpdateCell(); 866 startUpdateCell();
878 //mLabel->setMaximumWidth( width() - mItemList->lineWidth()*2); 867 //mLabel->setMaximumWidth( width() - mItemList->lineWidth()*2);
879 QPtrList<Event> events = mMonthView->calendar()->events( mDate, true ); 868 QPtrList<Event> events = mMonthView->calendar()->events( mDate, true );
880 Event *event; 869 Event *event;
881 for( event = events.first(); event; event = events.next() ) { // for event 870 for( event = events.first(); event; event = events.next() ) { // for event
882 insertEvent(event); 871 insertEvent(event);
883 } 872 }
884 // insert due todos 873 // insert due todos
885 QPtrList<Todo> todos = mMonthView->calendar()->todos( mDate ); 874 QPtrList<Todo> todos = mMonthView->calendar()->todos( mDate );
886 Todo *todo; 875 Todo *todo;
887 for(todo = todos.first(); todo; todo = todos.next()) { 876 for(todo = todos.first(); todo; todo = todos.next()) {
888 insertTodo( todo ); 877 insertTodo( todo );
889 } 878 }
890 finishUpdateCell(); 879 finishUpdateCell();
891 // if ( isVisible()) 880 // if ( isVisible())
892 //qApp->processEvents(); 881 //qApp->processEvents();
893} 882}
894 883
895void MonthViewCell::updateConfig( bool bigFont ) // = false 884void MonthViewCell::updateConfig( bool bigFont ) // = false
896{ 885{
897 886
898 if ( bigFont ) { 887 if ( bigFont ) {
899 QFont fo = KOPrefs::instance()->mMonthViewFont; 888 QFont fo = KOPrefs::instance()->mMonthViewFont;
900 int ps = fo.pointSize() + 2; 889 int ps = fo.pointSize() + 2;
901 if ( ps < 18 ) 890 if ( ps < 18 )
902 ps += 2; 891 ps += 2;
903 fo.setPointSize( ps ); 892 fo.setPointSize( ps );
904 setFont( fo ); 893 setFont( fo );
905 } else 894 } else
906 setFont( KOPrefs::instance()->mMonthViewFont ); 895 setFont( KOPrefs::instance()->mMonthViewFont );
907 896
908 QFontMetrics fm( font() ); 897 QFontMetrics fm( font() );
909 mLabelSize = fm.size( 0, "30" ) + QSize( 4, 2 ); 898 mLabelSize = fm.size( 0, "30" ) + QSize( 4, 2 );
910 mLabelBigSize = fm.size( 0, "Mag 30" ) + QSize( 2, 2 ); 899 mLabelBigSize = fm.size( 0, "Mag 30" ) + QSize( 2, 2 );
911 mHolidayPalette = mStandardPalette; 900 mHolidayPalette = mStandardPalette;
912 mPrimaryPalette = mStandardPalette; 901 mPrimaryPalette = mStandardPalette;
913 mNonPrimaryPalette = mStandardPalette; 902 mNonPrimaryPalette = mStandardPalette;
914 if ( KOPrefs::instance()->mMonthViewUsesDayColors ) { 903 if ( KOPrefs::instance()->mMonthViewUsesDayColors ) {
915 mHolidayPalette.setColor(QColorGroup::Base, KOPrefs::instance()->mMonthViewHolidayColor ); 904 mHolidayPalette.setColor(QColorGroup::Base, KOPrefs::instance()->mMonthViewHolidayColor );
916 mHolidayPalette.setColor(QColorGroup::Background, KOPrefs::instance()->mMonthViewHolidayColor ); 905 mHolidayPalette.setColor(QColorGroup::Background, KOPrefs::instance()->mMonthViewHolidayColor );
917 mHolidayPalette.setColor(QColorGroup::Foreground, KOPrefs::instance()->mMonthViewHolidayColor.dark()); 906 mHolidayPalette.setColor(QColorGroup::Foreground, KOPrefs::instance()->mMonthViewHolidayColor.dark());
918 mPrimaryPalette.setColor(QColorGroup::Foreground,KOPrefs::instance()->mMonthViewOddColor.dark()); 907 mPrimaryPalette.setColor(QColorGroup::Foreground,KOPrefs::instance()->mMonthViewOddColor.dark());
919 mPrimaryPalette.setColor(QColorGroup::Base,KOPrefs::instance()->mMonthViewOddColor); 908 mPrimaryPalette.setColor(QColorGroup::Base,KOPrefs::instance()->mMonthViewOddColor);
920 mPrimaryPalette.setColor(QColorGroup::Background,KOPrefs::instance()->mMonthViewOddColor); 909 mPrimaryPalette.setColor(QColorGroup::Background,KOPrefs::instance()->mMonthViewOddColor);
921 mNonPrimaryPalette.setColor(QColorGroup::Foreground,KOPrefs::instance()->mMonthViewEvenColor.dark()); 910 mNonPrimaryPalette.setColor(QColorGroup::Foreground,KOPrefs::instance()->mMonthViewEvenColor.dark());
922 mNonPrimaryPalette.setColor(QColorGroup::Base,KOPrefs::instance()->mMonthViewEvenColor); 911 mNonPrimaryPalette.setColor(QColorGroup::Base,KOPrefs::instance()->mMonthViewEvenColor);
923 mNonPrimaryPalette.setColor(QColorGroup::Background,KOPrefs::instance()->mMonthViewEvenColor); 912 mNonPrimaryPalette.setColor(QColorGroup::Background,KOPrefs::instance()->mMonthViewEvenColor);
924 } 913 }
925 //updateCell(); 914 //updateCell();
926} 915}
927 916
928void MonthViewCell::enableScrollBars( bool enabled ) 917void MonthViewCell::enableScrollBars( bool enabled )
929{ 918{
930 919
931 return; 920 return;
932 if ( enabled ) { 921 if ( enabled ) {
933 QListBoxItem *fi = firstItem (); 922 QListBoxItem *fi = firstItem ();
934 if (fi ) { 923 if (fi ) {
935 int ihei = fi->height( this ); 924 int ihei = fi->height( this );
936 int hei = numRows () * ihei; 925 int hei = numRows () * ihei;
937 if ( hei < height() - horizontalScrollBar()->height () ) { 926 if ( hei < height() - horizontalScrollBar()->height () ) {
938 setVScrollBarMode(QScrollView::AlwaysOff); 927 setVScrollBarMode(QScrollView::AlwaysOff);
@@ -992,129 +981,128 @@ void MonthViewCell::select()
992{ 981{
993 ;// updateCell(); 982 ;// updateCell();
994} 983}
995 984
996void MonthViewCell::resizeEvent ( QResizeEvent * e ) 985void MonthViewCell::resizeEvent ( QResizeEvent * e )
997{ 986{
998 if ( !mMonthView->isUpdatePossible() ) 987 if ( !mMonthView->isUpdatePossible() )
999 return; 988 return;
1000 //qDebug("++++++++++++++MonthViewCell::resizeEvent %d %d ", width(), height()); 989 //qDebug("++++++++++++++MonthViewCell::resizeEvent %d %d ", width(), height());
1001 deselect(); 990 deselect();
1002 mLabel->setMaximumHeight( height() - lineWidth()*2 ); 991 mLabel->setMaximumHeight( height() - lineWidth()*2 );
1003 992
1004 QString text; 993 QString text;
1005 mLabel->setText( text ); 994 mLabel->setText( text );
1006 bool smallDisplay = QApplication::desktop()->width() < 320 && KOPrefs::instance()->mMonthViewSatSunTog; 995 bool smallDisplay = QApplication::desktop()->width() < 320 && KOPrefs::instance()->mMonthViewSatSunTog;
1007 if ( KOPrefs::instance()->mMonthViewWeek || KOGlobals::self()->calendarSystem()->day( mDate ) == 1 || (mDate.dayOfWeek() == 7 && !smallDisplay ) || KOPrefs::instance()->mMonthShowShort) { 996 if ( KOPrefs::instance()->mMonthViewWeek || KOGlobals::self()->calendarSystem()->day( mDate ) == 1 || (mDate.dayOfWeek() == 7 && !smallDisplay ) || KOPrefs::instance()->mMonthShowShort) {
1008 text = KOGlobals::self()->calendarSystem()->monthName( mDate, true ) + " "; 997 text = KOGlobals::self()->calendarSystem()->monthName( mDate, true ) + " ";
1009 mLabel->resize( mLabelBigSize ); 998 mLabel->resize( mLabelBigSize );
1010 text += QString::number( KOGlobals::self()->calendarSystem()->day(mDate) ); 999 text += QString::number( KOGlobals::self()->calendarSystem()->day(mDate) );
1011 } else { 1000 } else {
1012 mLabel->resize( mLabelSize ); 1001 mLabel->resize( mLabelSize );
1013 text += QString::number( KOGlobals::self()->calendarSystem()->day(mDate) ); 1002 text += QString::number( KOGlobals::self()->calendarSystem()->day(mDate) );
1014 } 1003 }
1015 mLabel->setText( text ); 1004 mLabel->setText( text );
1016 1005
1017 int size = height() - mLabel->height() - lineWidth()-1; 1006 int size = height() - mLabel->height() - lineWidth()-1;
1018 //qDebug("LW %d ", lineWidth()); 1007 //qDebug("LW %d ", lineWidth());
1019 if ( size > 0 ) 1008 if ( size > 0 )
1020 verticalScrollBar()->setMaximumHeight( size ); 1009 verticalScrollBar()->setMaximumHeight( size );
1021 size = width() - mLabel->width() -lineWidth()-1; 1010 size = width() - mLabel->width() -lineWidth()-1;
1022 if ( size > 0 ) 1011 if ( size > 0 )
1023 horizontalScrollBar()->setMaximumWidth( size ); 1012 horizontalScrollBar()->setMaximumWidth( size );
1024 mLabel->move( width()-lineWidth() - mLabel->width(), height()-lineWidth() - mLabel->height() ); 1013 mLabel->move( width()-lineWidth() - mLabel->width(), height()-lineWidth() - mLabel->height() );
1025 //mLabel->setMaximumWidth( width() - mItemList->lineWidth()*2); 1014 //mLabel->setMaximumWidth( width() - mItemList->lineWidth()*2);
1026 // mItemList->resize ( width(), height () ); 1015 // mItemList->resize ( width(), height () );
1027 if ( e ) 1016 if ( e )
1028 KNoScrollListBox::resizeEvent ( e ); 1017 KNoScrollListBox::resizeEvent ( e );
1029} 1018}
1030 1019
1031void MonthViewCell::defaultAction( QListBoxItem *item ) 1020void MonthViewCell::defaultAction( QListBoxItem *item )
1032{ 1021{
1033 1022
1034 if ( !item ) { 1023 if ( !item ) {
1035 QDateTime dt( date(), QTime( KOPrefs::instance()->mStartTime, 0 ) ); 1024 QDateTime dt( date(), QTime( KOPrefs::instance()->mStartTime, 0 ) );
1036 emit newEventSignal( dt ); 1025 emit newEventSignal( dt );
1037 return; 1026 return;
1038 } 1027 }
1039 1028
1040 MonthViewItem *eventItem = static_cast<MonthViewItem *>( item ); 1029 MonthViewItem *eventItem = static_cast<MonthViewItem *>( item );
1041 Incidence *incidence = eventItem->incidence(); 1030 Incidence *incidence = eventItem->incidence();
1042 if ( incidence ) mMonthView->defaultAction( incidence ); 1031 if ( incidence ) mMonthView->defaultAction( incidence );
1043} 1032}
1044void MonthViewCell::showDay() 1033void MonthViewCell::showDay()
1045{ 1034{
1046 emit showDaySignal( date() ); 1035 emit showDaySignal( date() );
1047} 1036}
1048void MonthViewCell::newEvent() 1037void MonthViewCell::newEvent()
1049{ 1038{
1050 QDateTime dt( date(), QTime( KOPrefs::instance()->mStartTime, 0 ) ); 1039 QDateTime dt( date(), QTime( KOPrefs::instance()->mStartTime, 0 ) );
1051 emit newEventSignal( dt ); 1040 emit newEventSignal( dt );
1052} 1041}
1053void MonthViewCell::cellClicked( QListBoxItem *item ) 1042void MonthViewCell::cellClicked( QListBoxItem *item )
1054{ 1043{
1055 mMonthView->setSelectedCell( this ); 1044 mMonthView->setSelectedCell( this );
1056 qDebug("CELL ");
1057 if ( item == 0 ) { 1045 if ( item == 0 ) {
1058 QDateTime dt( date(), QTime( KOPrefs::instance()->mStartTime, 0 ) ); 1046 QDateTime dt( date(), QTime( KOPrefs::instance()->mStartTime, 0 ) );
1059 emit newEventSignal( dt ); 1047 emit newEventSignal( dt );
1060 return; 1048 return;
1061 } 1049 }
1062 1050
1063} 1051}
1064 1052
1065void MonthViewCell::contextMenu( QListBoxItem *item ) 1053void MonthViewCell::contextMenu( QListBoxItem *item )
1066{ 1054{
1067 mMonthView->setPopupCell( this ); 1055 mMonthView->setPopupCell( this );
1068 if ( !item ) { 1056 if ( !item ) {
1069 mMonthView->showContextMenu( 0 ); 1057 mMonthView->showContextMenu( 0 );
1070 return; 1058 return;
1071 } 1059 }
1072 MonthViewItem *eventItem = static_cast<MonthViewItem *>( item ); 1060 MonthViewItem *eventItem = static_cast<MonthViewItem *>( item );
1073 Incidence *incidence = eventItem->incidence(); 1061 Incidence *incidence = eventItem->incidence();
1074 if ( incidence ) mMonthView->showContextMenu( incidence ); 1062 if ( incidence ) mMonthView->showContextMenu( incidence );
1075} 1063}
1076 1064
1077void MonthViewCell::selection( QListBoxItem *item ) 1065void MonthViewCell::selection( QListBoxItem *item )
1078{ 1066{
1079 if ( !item ) return; 1067 if ( !item ) return;
1080 1068
1081 mMonthView->setSelectedCell( this ); 1069 mMonthView->setSelectedCell( this );
1082} 1070}
1083 1071
1084 1072
1085// ******************************************************************************* 1073// *******************************************************************************
1086// ******************************************************************************* 1074// *******************************************************************************
1087// ******************************************************************************* 1075// *******************************************************************************
1088 1076
1089 1077
1090KOMonthView::KOMonthView(Calendar *calendar, QWidget *parent, const char *name) 1078KOMonthView::KOMonthView(Calendar *calendar, QWidget *parent, const char *name)
1091 : KOEventView( calendar, parent, name ), 1079 : KOEventView( calendar, parent, name ),
1092 mDaysPerWeek( 7 ), mNumWeeks( 6 ), mNumCells( mDaysPerWeek * mNumWeeks ), 1080 mDaysPerWeek( 7 ), mNumWeeks( 6 ), mNumCells( mDaysPerWeek * mNumWeeks ),
1093 mWidthLongDayLabel( 0 ), mSelectedCell( 0 ) 1081 mWidthLongDayLabel( 0 ), mSelectedCell( 0 )
1094{ 1082{
1095 mFlagKeyPressed = false; 1083 mFlagKeyPressed = false;
1096 mShortDayLabelsM = false; 1084 mShortDayLabelsM = false;
1097 mShortDayLabelsW = false; 1085 mShortDayLabelsW = false;
1098 skipResize = false; 1086 skipResize = false;
1099 clPending = true; 1087 clPending = true;
1100 mPopupCell = 0; 1088 mPopupCell = 0;
1101 mNavigatorBar = new NavigatorBar( QDate::currentDate(), this, "useBigPixmaps" ); 1089 mNavigatorBar = new NavigatorBar( QDate::currentDate(), this, "useBigPixmaps" );
1102 mWidStack = new QWidgetStack( this ); 1090 mWidStack = new QWidgetStack( this );
1103 QVBoxLayout* hb = new QVBoxLayout( this ); 1091 QVBoxLayout* hb = new QVBoxLayout( this );
1104 mMonthView = new QWidget( mWidStack ); 1092 mMonthView = new QWidget( mWidStack );
1105 mWeekView = new QWidget( mWidStack ); 1093 mWeekView = new QWidget( mWidStack );
1106#if QT_VERSION >= 0x030000 1094#if QT_VERSION >= 0x030000
1107 mWidStack->addWidget(mMonthView ); 1095 mWidStack->addWidget(mMonthView );
1108 mWidStack->addWidget(mWeekView ); 1096 mWidStack->addWidget(mWeekView );
1109#else 1097#else
1110 mWidStack->addWidget( mMonthView, 1 ); 1098 mWidStack->addWidget( mMonthView, 1 );
1111 mWidStack->addWidget( mWeekView , 1 ); 1099 mWidStack->addWidget( mWeekView , 1 );
1112#endif 1100#endif
1113 hb->addWidget( mNavigatorBar ); 1101 hb->addWidget( mNavigatorBar );
1114 hb->addWidget( mWidStack ); 1102 hb->addWidget( mWidStack );
1115 mShowWeekView = KOPrefs::instance()->mMonthViewWeek; 1103 mShowWeekView = KOPrefs::instance()->mMonthViewWeek;
1116 updatePossible = false; 1104 updatePossible = false;
1117 //updatePossible = true; 1105 //updatePossible = true;
1118 mCells.setAutoDelete( true ); 1106 mCells.setAutoDelete( true );
1119 mShowSatSunComp = KOPrefs::instance()->mMonthViewSatSunTog ; 1107 mShowSatSunComp = KOPrefs::instance()->mMonthViewSatSunTog ;
1120 mDayLabels.resize( mDaysPerWeek ); 1108 mDayLabels.resize( mDaysPerWeek );
diff --git a/korganizer/korganizer.pro b/korganizer/korganizer.pro
index 1a81c7d..d88c300 100644
--- a/korganizer/korganizer.pro
+++ b/korganizer/korganizer.pro
@@ -74,137 +74,135 @@ SOURCES += ../outport/msoutl9.cpp \
74 74
75} 75}
76 76
77 77
78INTERFACES = kofilterview_base.ui 78INTERFACES = kofilterview_base.ui
79#filteredit_base.ui 79#filteredit_base.ui
80 80
81# kdateedit.h \ 81# kdateedit.h \
82 82
83HEADERS += datenavigatorcontainer.h \ 83HEADERS += datenavigatorcontainer.h \
84 filteredit_base.h \ 84 filteredit_base.h \
85 alarmclient.h \ 85 alarmclient.h \
86 calendarview.h \ 86 calendarview.h \
87 customlistviewitem.h \ 87 customlistviewitem.h \
88 datenavigator.h \ 88 datenavigator.h \
89 docprefs.h \ 89 docprefs.h \
90 filtereditdialog.h \ 90 filtereditdialog.h \
91 incomingdialog.h \ 91 incomingdialog.h \
92 incomingdialog_base.h \ 92 incomingdialog_base.h \
93 interfaces/korganizer/baseview.h \ 93 interfaces/korganizer/baseview.h \
94 interfaces/korganizer/calendarviewbase.h \ 94 interfaces/korganizer/calendarviewbase.h \
95 journalentry.h \ 95 journalentry.h \
96 kdatenavigator.h \ 96 kdatenavigator.h \
97 koagenda.h \ 97 koagenda.h \
98 koagendaitem.h \ 98 koagendaitem.h \
99 koagendaview.h \ 99 koagendaview.h \
100 kocounterdialog.h \ 100 kocounterdialog.h \
101 kodaymatrix.h \ 101 kodaymatrix.h \
102 kodialogmanager.h \ 102 kodialogmanager.h \
103 koeditordetails.h \ 103 koeditordetails.h \
104 koeditorgeneral.h \ 104 koeditorgeneral.h \
105 koeditorgeneralevent.h \ 105 koeditorgeneralevent.h \
106 koeditorgeneraltodo.h \ 106 koeditorgeneraltodo.h \
107 koeditorrecurrence.h \ 107 koeditorrecurrence.h \
108 koeventeditor.h \ 108 koeventeditor.h \
109 koeventpopupmenu.h \ 109 koeventpopupmenu.h \
110 koeventview.h \ 110 koeventview.h \
111 koeventviewer.h \ 111 koeventviewer.h \
112 koeventviewerdialog.h \ 112 koeventviewerdialog.h \
113 kofilterview.h \ 113 kofilterview.h \
114 koglobals.h \ 114 koglobals.h \
115 koincidenceeditor.h \ 115 koincidenceeditor.h \
116 kojournalview.h \ 116 kojournalview.h \
117 kolistview.h \ 117 kolistview.h \
118 kolocationbox.h \ 118 kolocationbox.h \
119 komonthview.h \ 119 komonthview.h \
120 koprefs.h \ 120 koprefs.h \
121 koprefsdialog.h \ 121 koprefsdialog.h \
122 kotimespanview.h \ 122 kotimespanview.h \
123 kotodoeditor.h \ 123 kotodoeditor.h \
124 kotodoview.h \ 124 kotodoview.h \
125 kotodoviewitem.h \ 125 kotodoviewitem.h \
126 koviewmanager.h \ 126 koviewmanager.h \
127 kowhatsnextview.h \ 127 kowhatsnextview.h \
128 ktimeedit.h \ 128 ktimeedit.h \
129 lineview.h \ 129 lineview.h \
130 mainwindow.h \ 130 mainwindow.h \
131 navigatorbar.h \ 131 navigatorbar.h \
132 outgoingdialog.h \ 132 outgoingdialog.h \
133 outgoingdialog_base.h \ 133 outgoingdialog_base.h \
134 publishdialog.h \ 134 publishdialog.h \
135 publishdialog_base.h \ 135 publishdialog_base.h \
136 savetemplatedialog.h \ 136 savetemplatedialog.h \
137 searchdialog.h \ 137 searchdialog.h \
138 simplealarmclient.h \
139 statusdialog.h \ 138 statusdialog.h \
140 timeline.h \ 139 timeline.h \
141 timespanview.h \ 140 timespanview.h \
142 version.h \ 141 version.h \
143 ../kalarmd/alarmdialog.h \ 142 ../kalarmd/alarmdialog.h \
144 143
145 144
146SOURCES += datenavigatorcontainer.cpp \ 145SOURCES += datenavigatorcontainer.cpp \
147filteredit_base.cpp \ 146filteredit_base.cpp \
148 calendarview.cpp \ 147 calendarview.cpp \
149 datenavigator.cpp \ 148 datenavigator.cpp \
150 docprefs.cpp \ 149 docprefs.cpp \
151 filtereditdialog.cpp \ 150 filtereditdialog.cpp \
152 incomingdialog.cpp \ 151 incomingdialog.cpp \
153 incomingdialog_base.cpp \ 152 incomingdialog_base.cpp \
154 journalentry.cpp \ 153 journalentry.cpp \
155 kdatenavigator.cpp \ 154 kdatenavigator.cpp \
156 koagenda.cpp \ 155 koagenda.cpp \
157 koagendaitem.cpp \ 156 koagendaitem.cpp \
158 koagendaview.cpp \ 157 koagendaview.cpp \
159 kocounterdialog.cpp \ 158 kocounterdialog.cpp \
160 kodaymatrix.cpp \ 159 kodaymatrix.cpp \
161 kodialogmanager.cpp \ 160 kodialogmanager.cpp \
162 koeditordetails.cpp \ 161 koeditordetails.cpp \
163 koeditorgeneral.cpp \ 162 koeditorgeneral.cpp \
164 koeditorgeneralevent.cpp \ 163 koeditorgeneralevent.cpp \
165 koeditorgeneraltodo.cpp \ 164 koeditorgeneraltodo.cpp \
166 koeditorrecurrence.cpp \ 165 koeditorrecurrence.cpp \
167 koeventeditor.cpp \ 166 koeventeditor.cpp \
168 koeventpopupmenu.cpp \ 167 koeventpopupmenu.cpp \
169 koeventview.cpp \ 168 koeventview.cpp \
170 koeventviewer.cpp \ 169 koeventviewer.cpp \
171 koeventviewerdialog.cpp \ 170 koeventviewerdialog.cpp \
172 kofilterview.cpp \ 171 kofilterview.cpp \
173 koglobals.cpp \ 172 koglobals.cpp \
174 koincidenceeditor.cpp \ 173 koincidenceeditor.cpp \
175 kojournalview.cpp \ 174 kojournalview.cpp \
176 kolistview.cpp \ 175 kolistview.cpp \
177 kolocationbox.cpp \ 176 kolocationbox.cpp \
178 komonthview.cpp \ 177 komonthview.cpp \
179 koprefs.cpp \ 178 koprefs.cpp \
180 koprefsdialog.cpp \ 179 koprefsdialog.cpp \
181 kotimespanview.cpp \ 180 kotimespanview.cpp \
182 kotodoeditor.cpp \ 181 kotodoeditor.cpp \
183 kotodoview.cpp \ 182 kotodoview.cpp \
184 kotodoviewitem.cpp \ 183 kotodoviewitem.cpp \
185 koviewmanager.cpp \ 184 koviewmanager.cpp \
186 kowhatsnextview.cpp \ 185 kowhatsnextview.cpp \
187 ktimeedit.cpp \ 186 ktimeedit.cpp \
188 lineview.cpp \ 187 lineview.cpp \
189 main.cpp \ 188 main.cpp \
190 mainwindow.cpp \ 189 mainwindow.cpp \
191 navigatorbar.cpp \ 190 navigatorbar.cpp \
192 outgoingdialog.cpp \ 191 outgoingdialog.cpp \
193 outgoingdialog_base.cpp \ 192 outgoingdialog_base.cpp \
194 publishdialog.cpp \ 193 publishdialog.cpp \
195 publishdialog_base.cpp \ 194 publishdialog_base.cpp \
196 savetemplatedialog.cpp \ 195 savetemplatedialog.cpp \
197 searchdialog.cpp \ 196 searchdialog.cpp \
198 simplealarmclient.cpp \
199 statusdialog.cpp \ 197 statusdialog.cpp \
200 timeline.cpp \ 198 timeline.cpp \
201 timespanview.cpp \ 199 timespanview.cpp \
202 ../kalarmd/alarmdialog.cpp 200 ../kalarmd/alarmdialog.cpp
203 201
204HEADERS += calprintbase.h calprinter.h calprintplugins.h cellitem.h 202HEADERS += calprintbase.h calprinter.h calprintplugins.h cellitem.h
205INTERFACES += calprintdayconfig_base.ui \ 203INTERFACES += calprintdayconfig_base.ui \
206 calprintmonthconfig_base.ui \ 204 calprintmonthconfig_base.ui \
207 calprinttodoconfig_base.ui \ 205 calprinttodoconfig_base.ui \
208 calprintweekconfig_base.ui 206 calprintweekconfig_base.ui
209SOURCES += calprintbase.cpp calprinter.cpp calprintplugins.cpp cellitem.cpp 207SOURCES += calprintbase.cpp calprinter.cpp calprintplugins.cpp cellitem.cpp
210 208
diff --git a/korganizer/korganizerE.pro b/korganizer/korganizerE.pro
index 91b5a01..553c265 100644
--- a/korganizer/korganizerE.pro
+++ b/korganizer/korganizerE.pro
@@ -24,129 +24,127 @@ LIBS += -lqpe
24LIBS += -ljpeg 24LIBS += -ljpeg
25LIBS += $(QTOPIALIB) 25LIBS += $(QTOPIALIB)
26LIBS += -L$(QPEDIR)/lib 26LIBS += -L$(QPEDIR)/lib
27 27
28INTERFACES = kofilterview_base.ui 28INTERFACES = kofilterview_base.ui
29#filteredit_base.ui 29#filteredit_base.ui
30 30
31HEADERS = datenavigatorcontainer.h \ 31HEADERS = datenavigatorcontainer.h \
32 wordsgerman.h \ 32 wordsgerman.h \
33 filteredit_base.h \ 33 filteredit_base.h \
34 alarmclient.h \ 34 alarmclient.h \
35 calendarview.h \ 35 calendarview.h \
36 customlistviewitem.h \ 36 customlistviewitem.h \
37 datenavigator.h \ 37 datenavigator.h \
38 docprefs.h \ 38 docprefs.h \
39 filtereditdialog.h \ 39 filtereditdialog.h \
40 incomingdialog.h \ 40 incomingdialog.h \
41 incomingdialog_base.h \ 41 incomingdialog_base.h \
42 interfaces/korganizer/baseview.h \ 42 interfaces/korganizer/baseview.h \
43 interfaces/korganizer/calendarviewbase.h \ 43 interfaces/korganizer/calendarviewbase.h \
44 journalentry.h \ 44 journalentry.h \
45 kdateedit.h \ 45 kdateedit.h \
46 kdatenavigator.h \ 46 kdatenavigator.h \
47 koagenda.h \ 47 koagenda.h \
48 koagendaitem.h \ 48 koagendaitem.h \
49 koagendaview.h \ 49 koagendaview.h \
50 kocounterdialog.h \ 50 kocounterdialog.h \
51 kodaymatrix.h \ 51 kodaymatrix.h \
52 kodialogmanager.h \ 52 kodialogmanager.h \
53 koeditordetails.h \ 53 koeditordetails.h \
54 koeditorgeneral.h \ 54 koeditorgeneral.h \
55 koeditorgeneralevent.h \ 55 koeditorgeneralevent.h \
56 koeditorgeneraltodo.h \ 56 koeditorgeneraltodo.h \
57 koeditorrecurrence.h \ 57 koeditorrecurrence.h \
58 koeventeditor.h \ 58 koeventeditor.h \
59 koeventpopupmenu.h \ 59 koeventpopupmenu.h \
60 koeventview.h \ 60 koeventview.h \
61 koeventviewer.h \ 61 koeventviewer.h \
62 koeventviewerdialog.h \ 62 koeventviewerdialog.h \
63 kofilterview.h \ 63 kofilterview.h \
64 koglobals.h \ 64 koglobals.h \
65 koincidenceeditor.h \ 65 koincidenceeditor.h \
66 kojournalview.h \ 66 kojournalview.h \
67 kolistview.h \ 67 kolistview.h \
68 kolocationbox.h \ 68 kolocationbox.h \
69 komonthview.h \ 69 komonthview.h \
70 koprefs.h \ 70 koprefs.h \
71 koprefsdialog.h \ 71 koprefsdialog.h \
72 kotimespanview.h \ 72 kotimespanview.h \
73 kotodoeditor.h \ 73 kotodoeditor.h \
74 kotodoview.h \ 74 kotodoview.h \
75 kotodoviewitem.h \ 75 kotodoviewitem.h \
76 koviewmanager.h \ 76 koviewmanager.h \
77 kowhatsnextview.h \ 77 kowhatsnextview.h \
78 ktimeedit.h \ 78 ktimeedit.h \
79 lineview.h \ 79 lineview.h \
80 mainwindow.h \ 80 mainwindow.h \
81 navigatorbar.h \ 81 navigatorbar.h \
82 outgoingdialog.h \ 82 outgoingdialog.h \
83 outgoingdialog_base.h \ 83 outgoingdialog_base.h \
84 publishdialog.h \ 84 publishdialog.h \
85 publishdialog_base.h \ 85 publishdialog_base.h \
86 savetemplatedialog.h \ 86 savetemplatedialog.h \
87 searchdialog.h \ 87 searchdialog.h \
88 simplealarmclient.h \
89 statusdialog.h \ 88 statusdialog.h \
90 timeline.h \ 89 timeline.h \
91 timespanview.h \ 90 timespanview.h \
92 version.h \ 91 version.h \
93 ../kalarmd/alarmdialog.h 92 ../kalarmd/alarmdialog.h
94 93
95SOURCES = datenavigatorcontainer.cpp \ 94SOURCES = datenavigatorcontainer.cpp \
96 filteredit_base.cpp \ 95 filteredit_base.cpp \
97 calendarview.cpp \ 96 calendarview.cpp \
98 datenavigator.cpp \ 97 datenavigator.cpp \
99 docprefs.cpp \ 98 docprefs.cpp \
100 filtereditdialog.cpp \ 99 filtereditdialog.cpp \
101 incomingdialog.cpp \ 100 incomingdialog.cpp \
102 incomingdialog_base.cpp \ 101 incomingdialog_base.cpp \
103 journalentry.cpp \ 102 journalentry.cpp \
104 kdatenavigator.cpp \ 103 kdatenavigator.cpp \
105 koagenda.cpp \ 104 koagenda.cpp \
106 koagendaitem.cpp \ 105 koagendaitem.cpp \
107 koagendaview.cpp \ 106 koagendaview.cpp \
108 kocounterdialog.cpp \ 107 kocounterdialog.cpp \
109 kodaymatrix.cpp \ 108 kodaymatrix.cpp \
110 kodialogmanager.cpp \ 109 kodialogmanager.cpp \
111 koeditordetails.cpp \ 110 koeditordetails.cpp \
112 koeditorgeneral.cpp \ 111 koeditorgeneral.cpp \
113 koeditorgeneralevent.cpp \ 112 koeditorgeneralevent.cpp \
114 koeditorgeneraltodo.cpp \ 113 koeditorgeneraltodo.cpp \
115 koeditorrecurrence.cpp \ 114 koeditorrecurrence.cpp \
116 koeventeditor.cpp \ 115 koeventeditor.cpp \
117 koeventpopupmenu.cpp \ 116 koeventpopupmenu.cpp \
118 koeventview.cpp \ 117 koeventview.cpp \
119 koeventviewer.cpp \ 118 koeventviewer.cpp \
120 koeventviewerdialog.cpp \ 119 koeventviewerdialog.cpp \
121 kofilterview.cpp \ 120 kofilterview.cpp \
122 koglobals.cpp \ 121 koglobals.cpp \
123 koincidenceeditor.cpp \ 122 koincidenceeditor.cpp \
124 kojournalview.cpp \ 123 kojournalview.cpp \
125 kolistview.cpp \ 124 kolistview.cpp \
126 kolocationbox.cpp \ 125 kolocationbox.cpp \
127 komonthview.cpp \ 126 komonthview.cpp \
128 koprefs.cpp \ 127 koprefs.cpp \
129 koprefsdialog.cpp \ 128 koprefsdialog.cpp \
130 kotimespanview.cpp \ 129 kotimespanview.cpp \
131 kotodoeditor.cpp \ 130 kotodoeditor.cpp \
132 kotodoview.cpp \ 131 kotodoview.cpp \
133 kotodoviewitem.cpp \ 132 kotodoviewitem.cpp \
134 koviewmanager.cpp \ 133 koviewmanager.cpp \
135 kowhatsnextview.cpp \ 134 kowhatsnextview.cpp \
136 ktimeedit.cpp \ 135 ktimeedit.cpp \
137 lineview.cpp \ 136 lineview.cpp \
138 main.cpp \ 137 main.cpp \
139 mainwindow.cpp \ 138 mainwindow.cpp \
140 navigatorbar.cpp \ 139 navigatorbar.cpp \
141 outgoingdialog.cpp \ 140 outgoingdialog.cpp \
142 outgoingdialog_base.cpp \ 141 outgoingdialog_base.cpp \
143 publishdialog.cpp \ 142 publishdialog.cpp \
144 publishdialog_base.cpp \ 143 publishdialog_base.cpp \
145 savetemplatedialog.cpp \ 144 savetemplatedialog.cpp \
146 searchdialog.cpp \ 145 searchdialog.cpp \
147 simplealarmclient.cpp \
148 statusdialog.cpp \ 146 statusdialog.cpp \
149 timeline.cpp \ 147 timeline.cpp \
150 timespanview.cpp \ 148 timespanview.cpp \
151 ../kalarmd/alarmdialog.cpp 149 ../kalarmd/alarmdialog.cpp
152 150
diff --git a/korganizer/kotodoview.cpp b/korganizer/kotodoview.cpp
index dd2c081..0a608dc 100644
--- a/korganizer/kotodoview.cpp
+++ b/korganizer/kotodoview.cpp
@@ -647,141 +647,135 @@ void KOTodoView::updateView()
647 647
648 mTodoListView->clear(); 648 mTodoListView->clear();
649 if ( mName == "todolistsmall" ) { 649 if ( mName == "todolistsmall" ) {
650 if ( KOPrefs::instance()->mTodoViewUsesSmallFont ) { 650 if ( KOPrefs::instance()->mTodoViewUsesSmallFont ) {
651 int ps = fo.pointSize() -2; 651 int ps = fo.pointSize() -2;
652 if ( ps > 12 ) 652 if ( ps > 12 )
653 ps -= 2; 653 ps -= 2;
654 fo.setPointSize( ps ); 654 fo.setPointSize( ps );
655 } 655 }
656 } 656 }
657 657
658 mTodoListView->setFont( fo ); 658 mTodoListView->setFont( fo );
659 // QFontMetrics fm ( KOPrefs::instance()->mTodoViewFont ); 659 // QFontMetrics fm ( KOPrefs::instance()->mTodoViewFont );
660 //mTodoListView->header()->setMaximumHeight(fm.height()); 660 //mTodoListView->header()->setMaximumHeight(fm.height());
661 QPtrList<Todo> todoList = calendar()->todos(); 661 QPtrList<Todo> todoList = calendar()->todos();
662 662
663/* 663/*
664 kdDebug() << "KOTodoView::updateView(): Todo List:" << endl; 664 kdDebug() << "KOTodoView::updateView(): Todo List:" << endl;
665 Event *t; 665 Event *t;
666 for(t = todoList.first(); t; t = todoList.next()) { 666 for(t = todoList.first(); t; t = todoList.next()) {
667 kdDebug() << " " << t->getSummary() << endl; 667 kdDebug() << " " << t->getSummary() << endl;
668 668
669 if (t->getRelatedTo()) { 669 if (t->getRelatedTo()) {
670 kdDebug() << " (related to " << t->getRelatedTo()->getSummary() << ")" << endl; 670 kdDebug() << " (related to " << t->getRelatedTo()->getSummary() << ")" << endl;
671 } 671 }
672 672
673 QPtrList<Event> l = t->getRelations(); 673 QPtrList<Event> l = t->getRelations();
674 Event *c; 674 Event *c;
675 for(c=l.first();c;c=l.next()) { 675 for(c=l.first();c;c=l.next()) {
676 kdDebug() << " - relation: " << c->getSummary() << endl; 676 kdDebug() << " - relation: " << c->getSummary() << endl;
677 } 677 }
678 } 678 }
679*/ 679*/
680 680
681 // Put for each Event a KOTodoViewItem in the list view. Don't rely on a 681 // Put for each Event a KOTodoViewItem in the list view. Don't rely on a
682 // specific order of events. That means that we have to generate parent items 682 // specific order of events. That means that we have to generate parent items
683 // recursively for proper hierarchical display of Todos. 683 // recursively for proper hierarchical display of Todos.
684 mTodoMap.clear(); 684 mTodoMap.clear();
685 Todo *todo; 685 Todo *todo;
686 todo = todoList.first();// todo; todo = todoList.next()) { 686 todo = todoList.first();// todo; todo = todoList.next()) {
687 while ( todo ) { 687 while ( todo ) {
688 bool next = true; 688 bool next = true;
689 // qDebug("todo %s ", todo->summary().latin1()); 689 // qDebug("todo %s ", todo->summary().latin1());
690 Incidence *incidence = todo->relatedTo(); 690 Incidence *incidence = todo->relatedTo();
691 while ( incidence ) { 691 while ( incidence ) {
692 if ( incidence->type() == "Todo") { 692 if ( incidence->type() == "Todo") {
693 //qDebug("related %s ",incidence->summary().latin1() ); 693 //qDebug("related %s ",incidence->summary().latin1() );
694 if ( !(todoList.contains ( ((Todo* )incidence ) ) )) { 694 if ( !(todoList.contains ( ((Todo* )incidence ) ) )) {
695 //qDebug("related not found "); 695 //qDebug("related not found ");
696 todoList.remove( ); 696 todoList.remove( );
697 todo = todoList.current(); 697 todo = todoList.current();
698 next = false; 698 next = false;
699 incidence = 0; 699 incidence = 0;
700 700
701 } else { 701 } else {
702 //qDebug("related found "); 702 //qDebug("related found ");
703 incidence = incidence->relatedTo(); 703 incidence = incidence->relatedTo();
704 } 704 }
705 } else 705 } else
706 incidence = 0; 706 incidence = 0;
707 } 707 }
708 if ( next ) 708 if ( next )
709 todo = todoList.next(); 709 todo = todoList.next();
710 } 710 }
711// qDebug("again .... "); 711
712// for(todo = todoList.first(); todo; todo = todoList.next()) {
713
714// qDebug("yytodo %s ", todo->summary().latin1());
715// }
716 //qDebug("for ");
717 for(todo = todoList.first(); todo; todo = todoList.next()) { 712 for(todo = todoList.first(); todo; todo = todoList.next()) {
718 if (!mTodoMap.contains(todo) && checkTodo( todo ) ) 713 if (!mTodoMap.contains(todo) && checkTodo( todo ) )
719 { 714 {
720 insertTodoItem(todo); 715 insertTodoItem(todo);
721 } 716 }
722 } 717 }
723 //qDebug("for end ");
724 // Restore opened/closed state 718 // Restore opened/closed state
725 mTodoListView->blockSignals( true ); 719 mTodoListView->blockSignals( true );
726 if( mDocPrefs ) restoreItemState( mTodoListView->firstChild() ); 720 if( mDocPrefs ) restoreItemState( mTodoListView->firstChild() );
727 mTodoListView->blockSignals( false ); 721 mTodoListView->blockSignals( false );
728 resetCurrentItem(); 722 resetCurrentItem();
729 processSelectionChange(); 723 processSelectionChange();
730} 724}
731 725
732void KOTodoView::storeCurrentItem() 726void KOTodoView::storeCurrentItem()
733{ 727{
734 mCurItem = 0; 728 mCurItem = 0;
735 mCurItemRootParent = 0; 729 mCurItemRootParent = 0;
736 mCurItemParent = 0; 730 mCurItemParent = 0;
737 mCurItemAbove = 0; 731 mCurItemAbove = 0;
738 mActiveItem = (KOTodoViewItem*)mTodoListView->currentItem(); 732 mActiveItem = (KOTodoViewItem*)mTodoListView->currentItem();
739 if (mActiveItem) { 733 if (mActiveItem) {
740 mCurItem = mActiveItem->todo(); 734 mCurItem = mActiveItem->todo();
741 KOTodoViewItem* activeItemAbove = (KOTodoViewItem*)mActiveItem->itemAbove (); 735 KOTodoViewItem* activeItemAbove = (KOTodoViewItem*)mActiveItem->itemAbove ();
742 if ( activeItemAbove ) 736 if ( activeItemAbove )
743 mCurItemAbove = activeItemAbove->todo(); 737 mCurItemAbove = activeItemAbove->todo();
744 mCurItemRootParent = mCurItem; 738 mCurItemRootParent = mCurItem;
745 mCurItemParent = mCurItemRootParent->relatedTo(); 739 mCurItemParent = mCurItemRootParent->relatedTo();
746 while ( mCurItemRootParent->relatedTo() != 0 ) 740 while ( mCurItemRootParent->relatedTo() != 0 )
747 mCurItemRootParent = mCurItemRootParent->relatedTo(); 741 mCurItemRootParent = mCurItemRootParent->relatedTo();
748 } 742 }
749 mActiveItem = 0; 743 mActiveItem = 0;
750} 744}
751 745
752void KOTodoView::resetCurrentItem() 746void KOTodoView::resetCurrentItem()
753{ 747{
754 mTodoListView->setFocus(); 748 mTodoListView->setFocus();
755 KOTodoViewItem* foundItem = 0; 749 KOTodoViewItem* foundItem = 0;
756 KOTodoViewItem* foundItemRoot = 0; 750 KOTodoViewItem* foundItemRoot = 0;
757 KOTodoViewItem* foundItemParent = 0; 751 KOTodoViewItem* foundItemParent = 0;
758 KOTodoViewItem* foundItemAbove = 0; 752 KOTodoViewItem* foundItemAbove = 0;
759 if ( mTodoListView->firstChild () ) { 753 if ( mTodoListView->firstChild () ) {
760 if ( mCurItem ) { 754 if ( mCurItem ) {
761 KOTodoViewItem* item = (KOTodoViewItem*)mTodoListView->firstChild (); 755 KOTodoViewItem* item = (KOTodoViewItem*)mTodoListView->firstChild ();
762 while ( item ) { 756 while ( item ) {
763 if ( item->todo() == mCurItem ) { 757 if ( item->todo() == mCurItem ) {
764 foundItem = item; 758 foundItem = item;
765 break; 759 break;
766 } else if ( item->todo() == mCurItemAbove ) { 760 } else if ( item->todo() == mCurItemAbove ) {
767 foundItemAbove = item; 761 foundItemAbove = item;
768 762
769 } 763 }
770 if ( item->todo() == mCurItemRootParent ) { 764 if ( item->todo() == mCurItemRootParent ) {
771 foundItemRoot = item; 765 foundItemRoot = item;
772 } 766 }
773 if ( item->todo() == mCurItemParent ) { 767 if ( item->todo() == mCurItemParent ) {
774 foundItemParent = item; 768 foundItemParent = item;
775 } 769 }
776 item = (KOTodoViewItem*)item->itemBelow(); 770 item = (KOTodoViewItem*)item->itemBelow();
777 } 771 }
778 if ( ! foundItem ) { 772 if ( ! foundItem ) {
779 if ( foundItemParent ) { 773 if ( foundItemParent ) {
780 foundItem = foundItemParent; 774 foundItem = foundItemParent;
781 } else { 775 } else {
782 if ( foundItemRoot ) 776 if ( foundItemRoot )
783 foundItem = foundItemRoot; 777 foundItem = foundItemRoot;
784 else 778 else
785 foundItem = foundItemAbove; 779 foundItem = foundItemAbove;
786 } 780 }
787 } 781 }
@@ -851,129 +845,128 @@ QMap<Todo *,KOTodoViewItem *>::ConstIterator
851 // and one into the map. Sure finding is more easy but why? -zecke 845 // and one into the map. Sure finding is more easy but why? -zecke
852 KOTodoViewItem *todoItem = new KOTodoViewItem(*itemIterator,todo,this); 846 KOTodoViewItem *todoItem = new KOTodoViewItem(*itemIterator,todo,this);
853 return mTodoMap.insert(todo,todoItem); 847 return mTodoMap.insert(todo,todoItem);
854 } else { 848 } else {
855// kdDebug() << " no Related" << endl; 849// kdDebug() << " no Related" << endl;
856 // see above -zecke 850 // see above -zecke
857 KOTodoViewItem *todoItem = new KOTodoViewItem(mTodoListView,todo,this); 851 KOTodoViewItem *todoItem = new KOTodoViewItem(mTodoListView,todo,this);
858 return mTodoMap.insert(todo,todoItem); 852 return mTodoMap.insert(todo,todoItem);
859 } 853 }
860} 854}
861 855
862 856
863void KOTodoView::updateConfig() 857void KOTodoView::updateConfig()
864{ 858{
865 updateView(); 859 updateView();
866 mTodoListView->repaintContents(); 860 mTodoListView->repaintContents();
867} 861}
868 862
869QPtrList<Incidence> KOTodoView::selectedIncidences() 863QPtrList<Incidence> KOTodoView::selectedIncidences()
870{ 864{
871 QPtrList<Incidence> selected; 865 QPtrList<Incidence> selected;
872 866
873 KOTodoViewItem *item = (KOTodoViewItem *)(mTodoListView->selectedItem()); 867 KOTodoViewItem *item = (KOTodoViewItem *)(mTodoListView->selectedItem());
874// if (!item) item = mActiveItem; 868// if (!item) item = mActiveItem;
875 if (item) selected.append(item->todo()); 869 if (item) selected.append(item->todo());
876 870
877 return selected; 871 return selected;
878} 872}
879 873
880QPtrList<Todo> KOTodoView::selectedTodos() 874QPtrList<Todo> KOTodoView::selectedTodos()
881{ 875{
882 QPtrList<Todo> selected; 876 QPtrList<Todo> selected;
883 877
884 KOTodoViewItem *item = (KOTodoViewItem *)(mTodoListView->selectedItem()); 878 KOTodoViewItem *item = (KOTodoViewItem *)(mTodoListView->selectedItem());
885// if (!item) item = mActiveItem; 879// if (!item) item = mActiveItem;
886 if (item) selected.append(item->todo()); 880 if (item) selected.append(item->todo());
887 881
888 return selected; 882 return selected;
889} 883}
890 884
891void KOTodoView::changeEventDisplay(Event *, int) 885void KOTodoView::changeEventDisplay(Event *, int)
892{ 886{
893 updateView(); 887 updateView();
894} 888}
895 889
896void KOTodoView::showDates(const QDate &, const QDate &) 890void KOTodoView::showDates(const QDate &, const QDate &)
897{ 891{
898} 892}
899 893
900void KOTodoView::showEvents(QPtrList<Event>) 894void KOTodoView::showEvents(QPtrList<Event>)
901{ 895{
902 kdDebug() << "KOTodoView::selectEvents(): not yet implemented" << endl; 896 kdDebug() << "KOTodoView::selectEvents(): not yet implemented" << endl;
903} 897}
904 898
905void KOTodoView::printPreview(CalPrinter *calPrinter, const QDate &fd, 899void KOTodoView::printPreview(CalPrinter *calPrinter, const QDate &fd,
906 const QDate &td) 900 const QDate &td)
907{ 901{
908#ifndef KORG_NOPRINTER 902#ifndef KORG_NOPRINTER
909 calPrinter->preview(CalPrinter::Todolist, fd, td); 903 calPrinter->preview(CalPrinter::Todolist, fd, td);
910#endif 904#endif
911} 905}
912 906
913void KOTodoView::editItem(QListViewItem *item ) 907void KOTodoView::editItem(QListViewItem *item )
914{ 908{
915 // qDebug("editItem(QListViewItem *item ) ");
916 emit editTodoSignal(((KOTodoViewItem *)item)->todo()); 909 emit editTodoSignal(((KOTodoViewItem *)item)->todo());
917} 910}
918 911
919void KOTodoView::showItem(QListViewItem *item,const QPoint &,int) 912void KOTodoView::showItem(QListViewItem *item,const QPoint &,int)
920{ 913{
921 emit showTodoSignal(((KOTodoViewItem *)item)->todo()); 914 emit showTodoSignal(((KOTodoViewItem *)item)->todo());
922} 915}
923 916
924void KOTodoView::popupMenu(QListViewItem *item,const QPoint &p,int column) 917void KOTodoView::popupMenu(QListViewItem *item,const QPoint &p,int column)
925{ 918{
926 pendingSubtodo = 0; 919 pendingSubtodo = 0;
927 mActiveItem = (KOTodoViewItem *)item; 920 mActiveItem = (KOTodoViewItem *)item;
928 if (item) { 921 if (item) {
929 switch (column){ 922 switch (column){
930 case 1: 923 case 1:
931 mPriorityPopupMenu->popup(QCursor::pos ()); break; 924 mPriorityPopupMenu->popup(QCursor::pos ()); break;
932 case 2: 925 case 2:
933 mPercentageCompletedPopupMenu->popup(QCursor::pos ()); break; 926 mPercentageCompletedPopupMenu->popup(QCursor::pos ()); break;
934 case 3: 927 case 3:
935 moveTodo(); 928 moveTodo();
936 break; 929 break;
937 case 8: 930 case 8:
938 getCategoryPopupMenu((KOTodoViewItem *)item)->popup(QCursor::pos ()); break; 931 getCategoryPopupMenu((KOTodoViewItem *)item)->popup(QCursor::pos ()); break;
939 default: 932 default:
940 mItemPopupMenu->popup(QCursor::pos()); 933 mItemPopupMenu->popup(QCursor::pos());
941 } 934 }
942 } else mPopupMenu->popup(QCursor::pos()); 935 } else mPopupMenu->popup(QCursor::pos());
943} 936}
944void KOTodoView::newTodo() 937void KOTodoView::newTodo()
945{ 938{
946 emit newTodoSignal(); 939 emit newTodoSignal();
947} 940}
948 941
949void KOTodoView::newSubTodo() 942void KOTodoView::newSubTodo()
950{ 943{
951 if (mActiveItem) { 944 if (mActiveItem) {
952 emit newSubTodoSignal(mActiveItem->todo()); 945 emit newSubTodoSignal(mActiveItem->todo());
953 } 946 }
954} 947}
955void KOTodoView::unparentTodo() 948void KOTodoView::unparentTodo()
956{ 949{
957 if (mActiveItem) { 950 if (mActiveItem) {
958 emit unparentTodoSignal(mActiveItem->todo()); 951 emit unparentTodoSignal(mActiveItem->todo());
959 } 952 }
960} 953}
961 954
962void KOTodoView::reparentTodo() 955void KOTodoView::reparentTodo()
963{ 956{
964 if (mActiveItem) { 957 if (mActiveItem) {
965 topLevelWidget()->setCaption(i18n("Click on new parent item")); 958 topLevelWidget()->setCaption(i18n("Click on new parent item"));
966 pendingSubtodo = mActiveItem; 959 pendingSubtodo = mActiveItem;
967 } 960 }
968} 961}
969void KOTodoView::editTodo() 962void KOTodoView::editTodo()
970{ 963{
971 if (mActiveItem) { 964 if (mActiveItem) {
972 emit editTodoSignal(mActiveItem->todo()); 965 emit editTodoSignal(mActiveItem->todo());
973 } 966 }
974} 967}
975void KOTodoView::cloneTodo() 968void KOTodoView::cloneTodo()
976{ 969{
977 if (mActiveItem) { 970 if (mActiveItem) {
978 emit cloneTodoSignal((Incidence*)mActiveItem->todo()); 971 emit cloneTodoSignal((Incidence*)mActiveItem->todo());
979 } 972 }
@@ -1035,221 +1028,203 @@ void KOTodoView::setNewPercentage(int index)
1035 par->setOn( false ); 1028 par->setOn( false );
1036 } 1029 }
1037 if (mPercentage[index] == 100) { 1030 if (mPercentage[index] == 100) {
1038 mActiveItem->todo()->setCompleted(QDateTime::currentDateTime()); 1031 mActiveItem->todo()->setCompleted(QDateTime::currentDateTime());
1039 } else { 1032 } else {
1040 mActiveItem->todo()->setCompleted(false); 1033 mActiveItem->todo()->setCompleted(false);
1041 } 1034 }
1042 mActiveItem->todo()->setPercentComplete(mPercentage[index]); 1035 mActiveItem->todo()->setPercentComplete(mPercentage[index]);
1043 mActiveItem->construct(); 1036 mActiveItem->construct();
1044 todoModified (mActiveItem->todo (), KOGlobals::COMPLETION_MODIFIED); 1037 todoModified (mActiveItem->todo (), KOGlobals::COMPLETION_MODIFIED);
1045 mActiveItem->todo()->setRevision( mActiveItem->todo()->revision()+1 ); 1038 mActiveItem->todo()->setRevision( mActiveItem->todo()->revision()+1 );
1046 } 1039 }
1047} 1040}
1048 1041
1049 1042
1050QPopupMenu * KOTodoView::getCategoryPopupMenu (KOTodoViewItem *todoItem) 1043QPopupMenu * KOTodoView::getCategoryPopupMenu (KOTodoViewItem *todoItem)
1051{ 1044{
1052 QPopupMenu* tempMenu = new QPopupMenu (this); 1045 QPopupMenu* tempMenu = new QPopupMenu (this);
1053 QStringList checkedCategories = todoItem->todo()->categories (); 1046 QStringList checkedCategories = todoItem->todo()->categories ();
1054 1047
1055 tempMenu->setCheckable (true); 1048 tempMenu->setCheckable (true);
1056 for (QStringList::Iterator it = KOPrefs::instance()->mCustomCategories.begin (); 1049 for (QStringList::Iterator it = KOPrefs::instance()->mCustomCategories.begin ();
1057 it != KOPrefs::instance()->mCustomCategories.end (); 1050 it != KOPrefs::instance()->mCustomCategories.end ();
1058 ++it) { 1051 ++it) {
1059 int index = tempMenu->insertItem (*it); 1052 int index = tempMenu->insertItem (*it);
1060 mCategory[index] = *it; 1053 mCategory[index] = *it;
1061 if (checkedCategories.find (*it) != checkedCategories.end ()) tempMenu->setItemChecked (index, true); 1054 if (checkedCategories.find (*it) != checkedCategories.end ()) tempMenu->setItemChecked (index, true);
1062 } 1055 }
1063 1056
1064 connect (tempMenu, SIGNAL (activated (int)), SLOT (changedCategories (int))); 1057 connect (tempMenu, SIGNAL (activated (int)), SLOT (changedCategories (int)));
1065 return tempMenu; 1058 return tempMenu;
1066 1059
1067 1060
1068} 1061}
1069void KOTodoView::changedCategories(int index) 1062void KOTodoView::changedCategories(int index)
1070{ 1063{
1071 if (mActiveItem && !mActiveItem->todo()->isReadOnly ()) { 1064 if (mActiveItem && !mActiveItem->todo()->isReadOnly ()) {
1072 QStringList categories = mActiveItem->todo()->categories (); 1065 QStringList categories = mActiveItem->todo()->categories ();
1073 QString colcat = categories.first(); 1066 QString colcat = categories.first();
1074 if (categories.find (mCategory[index]) != categories.end ()) 1067 if (categories.find (mCategory[index]) != categories.end ())
1075 categories.remove (mCategory[index]); 1068 categories.remove (mCategory[index]);
1076 else 1069 else
1077 categories.insert (categories.end(), mCategory[index]); 1070 categories.insert (categories.end(), mCategory[index]);
1078 categories.sort (); 1071 categories.sort ();
1079 if ( !colcat.isEmpty() ) { 1072 if ( !colcat.isEmpty() ) {
1080 if ( categories.find ( colcat ) != categories.end () ) { 1073 if ( categories.find ( colcat ) != categories.end () ) {
1081 categories.remove( colcat ); 1074 categories.remove( colcat );
1082 categories.prepend( colcat ); 1075 categories.prepend( colcat );
1083 } 1076 }
1084 } 1077 }
1085 mActiveItem->todo()->setCategories (categories); 1078 mActiveItem->todo()->setCategories (categories);
1086 mActiveItem->construct(); 1079 mActiveItem->construct();
1087 mActiveItem->todo()->setRevision( mActiveItem->todo()->revision()+1 ); 1080 mActiveItem->todo()->setRevision( mActiveItem->todo()->revision()+1 );
1088 todoModified (mActiveItem->todo (), KOGlobals::CATEGORY_MODIFIED); 1081 todoModified (mActiveItem->todo (), KOGlobals::CATEGORY_MODIFIED);
1089 } 1082 }
1090} 1083}
1091void KOTodoView::itemDoubleClicked(QListViewItem *item) 1084void KOTodoView::itemDoubleClicked(QListViewItem *item)
1092{ 1085{
1093 if ( pendingSubtodo != 0 ) { 1086 if ( pendingSubtodo != 0 ) {
1094 topLevelWidget()->setCaption(i18n("Reparenting aborted!")); 1087 topLevelWidget()->setCaption(i18n("Reparenting aborted!"));
1095 } 1088 }
1096 pendingSubtodo = 0; 1089 pendingSubtodo = 0;
1097 //int row = mTodoListView->header()->sectionAt ( mTodoListView->header()->mapFromGlobal( QCursor::pos()).x() ); 1090 //int row = mTodoListView->header()->sectionAt ( mTodoListView->header()->mapFromGlobal( QCursor::pos()).x() );
1098 int row = mTodoListView->header()->sectionAt ( mTodoListView->viewportToContents(mTodoListView->viewport()->mapFromGlobal( QCursor::pos())) .x() ); 1091 int row = mTodoListView->header()->sectionAt ( mTodoListView->viewportToContents(mTodoListView->viewport()->mapFromGlobal( QCursor::pos())) .x() );
1099 qDebug("ROW %d ", row); 1092 //qDebug("ROW %d ", row);
1100 if (!item) { 1093 if (!item) {
1101 newTodo(); 1094 newTodo();
1102 return; 1095 return;
1103 } else { 1096 } else {
1104 if ( row == 2 || row == 1 ) { 1097 if ( row == 2 || row == 1 ) {
1105 mActiveItem = (KOTodoViewItem *) item; 1098 mActiveItem = (KOTodoViewItem *) item;
1106 newSubTodo(); 1099 newSubTodo();
1107 return; 1100 return;
1108 } 1101 }
1109 if ( row == 5 || row == 6 ) { 1102 if ( row == 5 || row == 6 ) {
1110 mActiveItem = (KOTodoViewItem *) item; 1103 mActiveItem = (KOTodoViewItem *) item;
1111 toggleRunningItem(); 1104 toggleRunningItem();
1112 return; 1105 return;
1113 } 1106 }
1114 } 1107 }
1115 if ( KOPrefs::instance()->mEditOnDoubleClick ) 1108 if ( KOPrefs::instance()->mEditOnDoubleClick )
1116 editItem( item ); 1109 editItem( item );
1117 else 1110 else
1118 showItem( item , QPoint(), 0 ); 1111 showItem( item , QPoint(), 0 );
1119} 1112}
1120void KOTodoView::toggleRunningItem() 1113void KOTodoView::toggleRunningItem()
1121{ 1114{
1122 // qDebug("KOTodoView::toggleRunning() "); 1115 // qDebug("KOTodoView::toggleRunning() ");
1123 if ( ! mActiveItem ) 1116 if ( ! mActiveItem )
1124 return; 1117 return;
1125 Todo * t = mActiveItem->todo(); 1118 Todo * t = mActiveItem->todo();
1126 if ( t->isRunning() ) { 1119 if ( t->isRunning() ) {
1127 int result = KMessageBox::warningContinueCancel(this, 1120 int result = KMessageBox::warningContinueCancel(this,
1128 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); 1121 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);
1129 if (result != KMessageBox::Continue) return; 1122 if (result != KMessageBox::Continue) return;
1130 t->setRunning( false ); 1123 t->setRunning( false );
1131 mActiveItem->construct(); 1124 mActiveItem->construct();
1132 } else { 1125 } else {
1133 int result = KMessageBox::warningContinueCancel(this, 1126 int result = KMessageBox::warningContinueCancel(this,
1134 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); 1127 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);
1135 if (result != KMessageBox::Continue) return; 1128 if (result != KMessageBox::Continue) return;
1136 t->setRunning( true ); 1129 t->setRunning( true );
1137 mActiveItem->construct(); 1130 mActiveItem->construct();
1138 } 1131 }
1139} 1132}
1140 1133
1141void KOTodoView::itemClicked(QListViewItem *item) 1134void KOTodoView::itemClicked(QListViewItem *item)
1142{ 1135{
1143 //qDebug("KOTodoView::itemClicked %d", item); 1136 //qDebug("KOTodoView::itemClicked %d", item);
1144 if (!item) { 1137 if (!item) {
1145 if ( pendingSubtodo != 0 ) { 1138 if ( pendingSubtodo != 0 ) {
1146 topLevelWidget()->setCaption(i18n("Reparenting aborted!")); 1139 topLevelWidget()->setCaption(i18n("Reparenting aborted!"));
1147 } 1140 }
1148 pendingSubtodo = 0; 1141 pendingSubtodo = 0;
1149 return; 1142 return;
1150 } 1143 }
1151 KOTodoViewItem *todoItem = (KOTodoViewItem *)item; 1144 KOTodoViewItem *todoItem = (KOTodoViewItem *)item;
1152 if ( pendingSubtodo != 0 ) { 1145 if ( pendingSubtodo != 0 ) {
1153 bool allowReparent = true; 1146 bool allowReparent = true;
1154 QListViewItem *par = item; 1147 QListViewItem *par = item;
1155 while ( par ) { 1148 while ( par ) {
1156 if ( par == pendingSubtodo ) { 1149 if ( par == pendingSubtodo ) {
1157 allowReparent = false; 1150 allowReparent = false;
1158 break; 1151 break;
1159 } 1152 }
1160 par = par->parent(); 1153 par = par->parent();
1161 } 1154 }
1162 if ( !allowReparent ) { 1155 if ( !allowReparent ) {
1163 topLevelWidget()->setCaption(i18n("Recursive reparenting not possible!")); 1156 topLevelWidget()->setCaption(i18n("Recursive reparenting not possible!"));
1164 pendingSubtodo = 0; 1157 pendingSubtodo = 0;
1165 } else { 1158 } else {
1166 Todo* newParent = todoItem->todo(); 1159 Todo* newParent = todoItem->todo();
1167 Todo* newSub = pendingSubtodo->todo(); 1160 Todo* newSub = pendingSubtodo->todo();
1168 pendingSubtodo = 0; 1161 pendingSubtodo = 0;
1169 emit reparentTodoSignal( newParent,newSub ); 1162 emit reparentTodoSignal( newParent,newSub );
1170 return; 1163 return;
1171 } 1164 }
1172 } 1165 }
1173#if 0 1166
1174 // handled by the item itself
1175 bool completed = todoItem->todo()->isCompleted(); // Completed or not?
1176 qDebug("com %d ",completed );
1177 qDebug("itemclicked ");
1178 if (todoItem->isOn()) {
1179 qDebug("on ");
1180 if (!completed) {
1181 qDebug("set true ");
1182 todoItem->todo()->setCompleted(QDateTime::currentDateTime());
1183 }
1184 } else {
1185 qDebug("not on ");
1186 if (completed) {
1187 qDebug("set false ");
1188 todoItem->todo()->setCompleted(false);
1189 }
1190 }
1191#endif
1192} 1167}
1193 1168
1194void KOTodoView::setDocumentId( const QString &id ) 1169void KOTodoView::setDocumentId( const QString &id )
1195{ 1170{
1196 1171
1197 mDocPrefs->setDoc( id ); 1172 mDocPrefs->setDoc( id );
1198} 1173}
1199 1174
1200void KOTodoView::itemStateChanged( QListViewItem *item ) 1175void KOTodoView::itemStateChanged( QListViewItem *item )
1201{ 1176{
1202 if (!item) return; 1177 if (!item) return;
1203 1178
1204 KOTodoViewItem *todoItem = (KOTodoViewItem *)item; 1179 KOTodoViewItem *todoItem = (KOTodoViewItem *)item;
1205 1180
1206// kdDebug() << "KOTodoView::itemStateChanged(): " << todoItem->todo()->summary() << endl; 1181// kdDebug() << "KOTodoView::itemStateChanged(): " << todoItem->todo()->summary() << endl;
1207 1182
1208 if( mDocPrefs ) mDocPrefs->writeEntry( todoItem->todo()->uid(), todoItem->isOpen() ); 1183 if( mDocPrefs ) mDocPrefs->writeEntry( todoItem->todo()->uid(), todoItem->isOpen() );
1209} 1184}
1210 1185
1211void KOTodoView::saveLayout(KConfig *config, const QString &group) const 1186void KOTodoView::saveLayout(KConfig *config, const QString &group) const
1212{ 1187{
1213 mTodoListView->saveLayout(config,group); 1188 mTodoListView->saveLayout(config,group);
1214} 1189}
1215 1190
1216void KOTodoView::restoreLayout(KConfig *config, const QString &group) 1191void KOTodoView::restoreLayout(KConfig *config, const QString &group)
1217{ 1192{
1218 mTodoListView->restoreLayout(config,group); 1193 mTodoListView->restoreLayout(config,group);
1219} 1194}
1220 1195
1221void KOTodoView::processSelectionChange() 1196void KOTodoView::processSelectionChange()
1222{ 1197{
1223// kdDebug() << "KOTodoView::processSelectionChange()" << endl; 1198// kdDebug() << "KOTodoView::processSelectionChange()" << endl;
1224 1199
1225 KOTodoViewItem *item = 1200 KOTodoViewItem *item =
1226 static_cast<KOTodoViewItem *>( mTodoListView->selectedItem() ); 1201 static_cast<KOTodoViewItem *>( mTodoListView->selectedItem() );
1227 1202
1228 if ( !item ) { 1203 if ( !item ) {
1229 emit incidenceSelected( 0 ); 1204 emit incidenceSelected( 0 );
1230 } else { 1205 } else {
1231 emit incidenceSelected( item->todo() ); 1206 emit incidenceSelected( item->todo() );
1232 } 1207 }
1233} 1208}
1234 1209
1235void KOTodoView::modified(bool b) 1210void KOTodoView::modified(bool b)
1236{ 1211{
1237 emit isModified(b); 1212 emit isModified(b);
1238} 1213}
1239void KOTodoView::setTodoModified( Todo* todo ) 1214void KOTodoView::setTodoModified( Todo* todo )
1240{ 1215{
1241 todoModified( todo, KOGlobals::UNKNOWN_MODIFIED ); 1216 todoModified( todo, KOGlobals::UNKNOWN_MODIFIED );
1242} 1217}
1243void KOTodoView::clearSelection() 1218void KOTodoView::clearSelection()
1244{ 1219{
1245 mTodoListView->selectAll( false ); 1220 mTodoListView->selectAll( false );
1246} 1221}
1247void KOTodoView::setAllOpen() 1222void KOTodoView::setAllOpen()
1248{ 1223{
1249 if ( isFlatDisplay ) { 1224 if ( isFlatDisplay ) {
1250 isFlatDisplay = false; 1225 isFlatDisplay = false;
1251 mPopupMenu->setItemChecked( 8,false ); 1226 mPopupMenu->setItemChecked( 8,false );
1252 updateView(); 1227 updateView();
1253 } else { 1228 } else {
1254 storeCurrentItem(); 1229 storeCurrentItem();
1255 } 1230 }
diff --git a/korganizer/koviewmanager.cpp b/korganizer/koviewmanager.cpp
index f1f2dd2..3aa9b6c 100644
--- a/korganizer/koviewmanager.cpp
+++ b/korganizer/koviewmanager.cpp
@@ -489,137 +489,129 @@ void KOViewManager::showAgendaView( bool fullScreen )
489 mMainView, SLOT( processMainViewSelection( Incidence * ) ) ); 489 mMainView, SLOT( processMainViewSelection( Incidence * ) ) );
490 490
491 connect(mAgendaView, SIGNAL( toggleExpand() ), 491 connect(mAgendaView, SIGNAL( toggleExpand() ),
492 mMainView, SLOT( toggleExpand() ) ); 492 mMainView, SLOT( toggleExpand() ) );
493 493
494 connect( mAgendaView, SIGNAL( cloneIncidenceSignal(Incidence *) ), 494 connect( mAgendaView, SIGNAL( cloneIncidenceSignal(Incidence *) ),
495 mMainView, SLOT(cloneIncidence(Incidence *) ) ) ; 495 mMainView, SLOT(cloneIncidence(Incidence *) ) ) ;
496 connect( mAgendaView, SIGNAL( cancelIncidenceSignal(Incidence *) ), 496 connect( mAgendaView, SIGNAL( cancelIncidenceSignal(Incidence *) ),
497 mMainView, SLOT(cancelIncidence(Incidence *) ) ) ; 497 mMainView, SLOT(cancelIncidence(Incidence *) ) ) ;
498 connect(mMainView, SIGNAL(configChanged()), mAgendaView, SLOT(updateConfig())); 498 connect(mMainView, SIGNAL(configChanged()), mAgendaView, SLOT(updateConfig()));
499 connect( mMainView, SIGNAL( todoModified( Todo *, int )), mAgendaView, 499 connect( mMainView, SIGNAL( todoModified( Todo *, int )), mAgendaView,
500 SLOT( updateTodo( Todo *, int ) ) ); 500 SLOT( updateTodo( Todo *, int ) ) );
501 connect( mAgendaView,SIGNAL( todoMoved( Todo *, int )), 501 connect( mAgendaView,SIGNAL( todoMoved( Todo *, int )),
502 mMainView, SIGNAL( todoModified( Todo *, int ))); 502 mMainView, SIGNAL( todoModified( Todo *, int )));
503 connect( mAgendaView, SIGNAL( moveIncidenceSignal( Incidence * ) ), 503 connect( mAgendaView, SIGNAL( moveIncidenceSignal( Incidence * ) ),
504 mMainView, SLOT ( moveIncidence( Incidence * ) ) ); 504 mMainView, SLOT ( moveIncidence( Incidence * ) ) );
505 connect( mAgendaView, SIGNAL( beamIncidenceSignal( Incidence * ) ), 505 connect( mAgendaView, SIGNAL( beamIncidenceSignal( Incidence * ) ),
506 mMainView, SLOT ( beamIncidence( Incidence * ) ) ); 506 mMainView, SLOT ( beamIncidence( Incidence * ) ) );
507 connect( mAgendaView, SIGNAL( selectWeekNum( int ) ), 507 connect( mAgendaView, SIGNAL( selectWeekNum( int ) ),
508 mMainView->dateNavigator(), SLOT ( selectWeek( int ) ) ); 508 mMainView->dateNavigator(), SLOT ( selectWeek( int ) ) );
509 mAgendaView->readSettings(); 509 mAgendaView->readSettings();
510 mAgendaView->updateConfig(); 510 mAgendaView->updateConfig();
511 } 511 }
512 512
513 showView( mAgendaView, full); 513 showView( mAgendaView, full);
514 KOPrefs::instance()->mCurrentDisplayedView = VIEW_A_VIEW; 514 KOPrefs::instance()->mCurrentDisplayedView = VIEW_A_VIEW;
515} 515}
516 516
517void KOViewManager::showDayView() 517void KOViewManager::showDayView()
518{ 518{
519 mCurrentAgendaView = mMainView->dateNavigator()->selectedDates().count(); 519 mCurrentAgendaView = mMainView->dateNavigator()->selectedDates().count();
520 mFlagShowNextxDays = false; 520 mFlagShowNextxDays = false;
521 globalFlagBlockLabel = 1; 521 globalFlagBlockLabel = 1;
522 globalFlagBlockAgenda = 1; 522 globalFlagBlockAgenda = 1;
523 if ( mCurrentAgendaView != 1 ) 523 if ( mCurrentAgendaView != 1 )
524 mCurrentAgendaView = -1; 524 mCurrentAgendaView = -1;
525 showAgendaView(); 525 showAgendaView();
526 qApp->processEvents(); 526 qApp->processEvents();
527 globalFlagBlockAgenda = 2; 527 globalFlagBlockAgenda = 2;
528 globalFlagBlockLabel = 0; 528 globalFlagBlockLabel = 0;
529 mMainView->dateNavigator()->selectDates( 1 ); 529 mMainView->dateNavigator()->selectDates( 1 );
530 mCurrentAgendaView = 1 ; 530 mCurrentAgendaView = 1 ;
531 531
532} 532}
533 533
534void KOViewManager::showWorkWeekView() 534void KOViewManager::showWorkWeekView()
535{ 535{
536 mCurrentAgendaView = mMainView->dateNavigator()->selectedDates().count(); 536 mCurrentAgendaView = mMainView->dateNavigator()->selectedDates().count();
537 mFlagShowNextxDays = false; 537 mFlagShowNextxDays = false;
538 globalFlagBlockAgenda = 1; 538 globalFlagBlockAgenda = 1;
539 globalFlagBlockLabel = 1; 539 globalFlagBlockLabel = 1;
540 if ( mCurrentAgendaView != 5 ) 540 if ( mCurrentAgendaView != 5 )
541 mCurrentAgendaView = -1; 541 mCurrentAgendaView = -1;
542 showAgendaView(); 542 showAgendaView();
543 qApp->processEvents(); 543 qApp->processEvents();
544 globalFlagBlockAgenda = 2; 544 globalFlagBlockAgenda = 2;
545 globalFlagBlockLabel = 0; 545 globalFlagBlockLabel = 0;
546 mMainView->dateNavigator()->selectWorkWeek(); 546 mMainView->dateNavigator()->selectWorkWeek();
547 mCurrentAgendaView = 5 ; 547 mCurrentAgendaView = 5 ;
548 548
549} 549}
550 550
551void KOViewManager::showWeekView() 551void KOViewManager::showWeekView()
552{ 552{
553 /* 553
554 globalFlagBlockAgenda = 2;
555 qDebug("4globalFlagBlockAgenda = 2; ");
556 //globalFlagBlockPainting = true;
557 mMainView->dateNavigator()->selectWeek();
558 showAgendaView();
559 */
560
561
562 mCurrentAgendaView = mMainView->dateNavigator()->selectedDates().count(); 554 mCurrentAgendaView = mMainView->dateNavigator()->selectedDates().count();
563 mFlagShowNextxDays = false; 555 mFlagShowNextxDays = false;
564 globalFlagBlockAgenda = 1; 556 globalFlagBlockAgenda = 1;
565 globalFlagBlockLabel = 1; 557 globalFlagBlockLabel = 1;
566 if ( mCurrentAgendaView != 7 ) 558 if ( mCurrentAgendaView != 7 )
567 mCurrentAgendaView = -1; 559 mCurrentAgendaView = -1;
568 showAgendaView(); 560 showAgendaView();
569 qApp->processEvents(); 561 qApp->processEvents();
570 globalFlagBlockAgenda = 2; 562 globalFlagBlockAgenda = 2;
571 globalFlagBlockLabel = 0; 563 globalFlagBlockLabel = 0;
572 mMainView->dateNavigator()->selectWeek(); 564 mMainView->dateNavigator()->selectWeek();
573 mCurrentAgendaView = 7 ; 565 mCurrentAgendaView = 7 ;
574} 566}
575 567
576void KOViewManager::showNextXView() 568void KOViewManager::showNextXView()
577{ 569{
578 570
579 globalFlagBlockAgenda = 1; 571 globalFlagBlockAgenda = 1;
580 if ( mCurrentAgendaView != 3 ) 572 if ( mCurrentAgendaView != 3 )
581 mCurrentAgendaView = -1; 573 mCurrentAgendaView = -1;
582 showAgendaView(KOPrefs::instance()->mFullViewMonth); 574 showAgendaView(KOPrefs::instance()->mFullViewMonth);
583 globalFlagBlockAgenda = 2; 575 globalFlagBlockAgenda = 2;
584 mMainView->dateNavigator()->selectDates( QDate::currentDate(), 576 mMainView->dateNavigator()->selectDates( QDate::currentDate(),
585 KOPrefs::instance()->mNextXDays ); 577 KOPrefs::instance()->mNextXDays );
586 mFlagShowNextxDays = true; 578 mFlagShowNextxDays = true;
587 mCurrentAgendaView = 3 ; 579 mCurrentAgendaView = 3 ;
588 KOPrefs::instance()->mCurrentDisplayedView = VIEW_NX_VIEW; 580 KOPrefs::instance()->mCurrentDisplayedView = VIEW_NX_VIEW;
589} 581}
590bool KOViewManager::showsNextDays() 582bool KOViewManager::showsNextDays()
591{ 583{
592 return mFlagShowNextxDays; 584 return mFlagShowNextxDays;
593} 585}
594void KOViewManager::createMonthView() 586void KOViewManager::createMonthView()
595{ 587{
596if (!mMonthView) { 588if (!mMonthView) {
597 mMonthView = new KOMonthView(mMainView->calendar(), mMainView->viewStack(), "KOViewManager::MonthView"); 589 mMonthView = new KOMonthView(mMainView->calendar(), mMainView->viewStack(), "KOViewManager::MonthView");
598 590
599 addView(mMonthView); 591 addView(mMonthView);
600 // mMonthView->show(); 592 // mMonthView->show();
601 // SIGNALS/SLOTS FOR MONTH VIEW 593 // SIGNALS/SLOTS FOR MONTH VIEW
602 594
603 connect(mMonthView,SIGNAL(showJournalSignal( int, QDate )),SLOT(showDateView( int, QDate ))); 595 connect(mMonthView,SIGNAL(showJournalSignal( int, QDate )),SLOT(showDateView( int, QDate )));
604 596
605 connect(mMonthView, SIGNAL(newTodoSignal(QDateTime,bool)), 597 connect(mMonthView, SIGNAL(newTodoSignal(QDateTime,bool)),
606 mMainView, SLOT(newTodoDateTime(QDateTime, bool))); 598 mMainView, SLOT(newTodoDateTime(QDateTime, bool)));
607 599
608 600
609 connect(mMonthView, SIGNAL(newEventSignal(QDateTime)), 601 connect(mMonthView, SIGNAL(newEventSignal(QDateTime)),
610 mMainView, SLOT(newEvent(QDateTime))); 602 mMainView, SLOT(newEvent(QDateTime)));
611 603
612 connect(mMonthView, SIGNAL(showIncidenceSignal(Incidence *)), 604 connect(mMonthView, SIGNAL(showIncidenceSignal(Incidence *)),
613 mMainView, SLOT(showIncidence(Incidence *))); 605 mMainView, SLOT(showIncidence(Incidence *)));
614 connect(mMonthView, SIGNAL(editIncidenceSignal(Incidence *)), 606 connect(mMonthView, SIGNAL(editIncidenceSignal(Incidence *)),
615 mMainView, SLOT(editIncidence(Incidence *))); 607 mMainView, SLOT(editIncidence(Incidence *)));
616 connect(mMonthView, SIGNAL(deleteIncidenceSignal(Incidence *)), 608 connect(mMonthView, SIGNAL(deleteIncidenceSignal(Incidence *)),
617 mMainView, SLOT(deleteIncidence(Incidence *))); 609 mMainView, SLOT(deleteIncidence(Incidence *)));
618 610
619 connect( mMonthView, SIGNAL( incidenceSelected( Incidence * ) ), 611 connect( mMonthView, SIGNAL( incidenceSelected( Incidence * ) ),
620 mMainView, SLOT( processMainViewSelection( Incidence * ) ) ); 612 mMainView, SLOT( processMainViewSelection( Incidence * ) ) );
621 connect( mMonthView, SIGNAL( cloneIncidenceSignal( Incidence * ) ), 613 connect( mMonthView, SIGNAL( cloneIncidenceSignal( Incidence * ) ),
622 mMainView, SLOT ( cloneIncidence( Incidence * ) ) ); 614 mMainView, SLOT ( cloneIncidence( Incidence * ) ) );
623 connect( mMonthView, SIGNAL( cancelIncidenceSignal( Incidence * ) ), 615 connect( mMonthView, SIGNAL( cancelIncidenceSignal( Incidence * ) ),
624 mMainView, SLOT ( cancelIncidence( Incidence * ) ) ); 616 mMainView, SLOT ( cancelIncidence( Incidence * ) ) );
625 617
diff --git a/korganizer/kowhatsnextview.cpp b/korganizer/kowhatsnextview.cpp
index 8473db9..65d8ac3 100644
--- a/korganizer/kowhatsnextview.cpp
+++ b/korganizer/kowhatsnextview.cpp
@@ -23,131 +23,129 @@
23#include <qfileinfo.h> 23#include <qfileinfo.h>
24#include <qlabel.h> 24#include <qlabel.h>
25 25
26#include <qapplication.h> 26#include <qapplication.h>
27#ifdef DESKTOP_VERSION 27#ifdef DESKTOP_VERSION
28#include <qpaintdevicemetrics.h> 28#include <qpaintdevicemetrics.h>
29#endif 29#endif
30#include <kglobal.h> 30#include <kglobal.h>
31#include <klocale.h> 31#include <klocale.h>
32#include <kdebug.h> 32#include <kdebug.h>
33#include <kiconloader.h> 33#include <kiconloader.h>
34#include <kmessagebox.h> 34#include <kmessagebox.h>
35 35
36#include <libkcal/calendar.h> 36#include <libkcal/calendar.h>
37 37
38#ifndef KORG_NOPRINTER 38#ifndef KORG_NOPRINTER
39#include "calprinter.h" 39#include "calprinter.h"
40#endif 40#endif
41#include "koglobals.h" 41#include "koglobals.h"
42#include "koprefs.h" 42#include "koprefs.h"
43#include "koeventviewerdialog.h" 43#include "koeventviewerdialog.h"
44#include "koeventviewer.h" 44#include "koeventviewer.h"
45#include <qstylesheet.h> 45#include <qstylesheet.h>
46#include "kowhatsnextview.h" 46#include "kowhatsnextview.h"
47using namespace KOrg; 47using namespace KOrg;
48 48
49void WhatsNextTextBrowser::setSource(const QString& n) 49void WhatsNextTextBrowser::setSource(const QString& n)
50{ 50{
51 51
52 if (n.startsWith("event:")) { 52 if (n.startsWith("event:")) {
53 emit showIncidence(n); 53 emit showIncidence(n);
54 return; 54 return;
55 } else if (n.startsWith("todo:")) { 55 } else if (n.startsWith("todo:")) {
56 emit showIncidence(n); 56 emit showIncidence(n);
57 return; 57 return;
58 } else { 58 } else {
59 QTextBrowser::setSource(n); 59 QTextBrowser::setSource(n);
60 } 60 }
61} 61}
62void WhatsNextTextBrowser::printMe() 62void WhatsNextTextBrowser::printMe()
63{ 63{
64#ifdef DESKTOP_VERSION 64#ifdef DESKTOP_VERSION
65 KOPrintPrefs pp ( this ); 65 KOPrintPrefs pp ( this );
66 if (!pp.exec() ) 66 if (!pp.exec() )
67 return; 67 return;
68 int scaleval = pp.printMode() ; 68 int scaleval = pp.printMode() ;
69 69
70 QPrinter printer; 70 QPrinter printer;
71 if (!printer.setup() ) 71 if (!printer.setup() )
72 return; 72 return;
73 QPainter p; 73 QPainter p;
74 p.begin ( &printer ); 74 p.begin ( &printer );
75 QPaintDeviceMetrics m = QPaintDeviceMetrics ( &printer ); 75 QPaintDeviceMetrics m = QPaintDeviceMetrics ( &printer );
76 float dx, dy; 76 float dx, dy;
77 int wid = (m.width() * 9)/10; 77 int wid = (m.width() * 9)/10;
78 dx = (float) wid/(float)contentsWidth (); 78 dx = (float) wid/(float)contentsWidth ();
79 dy = (float)(m.height()) / (float)contentsHeight (); 79 dy = (float)(m.height()) / (float)contentsHeight ();
80 float scale; 80 float scale;
81 // scale to fit the width or height of the paper 81 // scale to fit the width or height of the paper
82 if ( dx < dy ) 82 if ( dx < dy )
83 scale = dx; 83 scale = dx;
84 else 84 else
85 scale = dy; 85 scale = dy;
86 p.translate( m.width()/10,0 ); 86 p.translate( m.width()/10,0 );
87 qDebug("Scale: %f ", scale );
88 if ( scaleval == 2 || scaleval == 1 && scale < 1.0 ) { 87 if ( scaleval == 2 || scaleval == 1 && scale < 1.0 ) {
89 qDebug("SCALE ");
90 p.scale( scale, scale ); 88 p.scale( scale, scale );
91 } 89 }
92 drawContents ( &p, 0,0, contentsWidth (), contentsHeight () ); 90 drawContents ( &p, 0,0, contentsWidth (), contentsHeight () );
93 p.end(); 91 p.end();
94#endif 92#endif
95} 93}
96 94
97KOWhatsNextView::KOWhatsNextView(Calendar *calendar, QWidget *parent, 95KOWhatsNextView::KOWhatsNextView(Calendar *calendar, QWidget *parent,
98 const char *name) 96 const char *name)
99 : KOrg::BaseView(calendar, parent, name) 97 : KOrg::BaseView(calendar, parent, name)
100{ 98{
101 // mDateLabel = 99 // mDateLabel =
102 // new QLabel(KGlobal::locale()->formatDate(QDate::currentDate()),this); 100 // new QLabel(KGlobal::locale()->formatDate(QDate::currentDate()),this);
103 // mDateLabel->setMargin(2); 101 // mDateLabel->setMargin(2);
104 // mDateLabel->setAlignment(AlignCenter); 102 // mDateLabel->setAlignment(AlignCenter);
105 setFont( KOPrefs::instance()->mWhatsNextFont ); 103 setFont( KOPrefs::instance()->mWhatsNextFont );
106 mView = new WhatsNextTextBrowser(this); 104 mView = new WhatsNextTextBrowser(this);
107 connect(mView,SIGNAL(showIncidence(const QString &)),SLOT(showIncidence(const QString &))); 105 connect(mView,SIGNAL(showIncidence(const QString &)),SLOT(showIncidence(const QString &)));
108 QStyleSheet* stsh = mView->styleSheet(); 106 QStyleSheet* stsh = mView->styleSheet();
109 QStyleSheetItem * style ; 107 QStyleSheetItem * style ;
110 style = stsh->item ("h2" ); 108 style = stsh->item ("h2" );
111 if ( style ) { 109 if ( style ) {
112 style->setMargin(QStyleSheetItem::MarginAll,0); 110 style->setMargin(QStyleSheetItem::MarginAll,0);
113 } 111 }
114 style = stsh->item ("h3" ); 112 style = stsh->item ("h3" );
115 if ( style ) { 113 if ( style ) {
116 style->setMargin(QStyleSheetItem::MarginAll,0); 114 style->setMargin(QStyleSheetItem::MarginAll,0);
117 } 115 }
118 mEventViewer = 0; 116 mEventViewer = 0;
119 117
120 QBoxLayout *topLayout = new QVBoxLayout(this); 118 QBoxLayout *topLayout = new QVBoxLayout(this);
121 // topLayout->addWidget(mDateLabel); 119 // topLayout->addWidget(mDateLabel);
122 topLayout->addWidget(mView); 120 topLayout->addWidget(mView);
123 mTimer = new QTimer( this ); 121 mTimer = new QTimer( this );
124 connect(mTimer,SIGNAL( timeout() ),this, SLOT(updateView())); 122 connect(mTimer,SIGNAL( timeout() ),this, SLOT(updateView()));
125 123
126 connect(mView->horizontalScrollBar (),SIGNAL( sliderReleased () ),this, SLOT(restartTimer())); 124 connect(mView->horizontalScrollBar (),SIGNAL( sliderReleased () ),this, SLOT(restartTimer()));
127 connect(mView->verticalScrollBar (),SIGNAL( sliderReleased () ),this, SLOT(restartTimer())); 125 connect(mView->verticalScrollBar (),SIGNAL( sliderReleased () ),this, SLOT(restartTimer()));
128} 126}
129 127
130KOWhatsNextView::~KOWhatsNextView() 128KOWhatsNextView::~KOWhatsNextView()
131{ 129{
132} 130}
133 131
134int KOWhatsNextView::maxDatesHint() 132int KOWhatsNextView::maxDatesHint()
135{ 133{
136 return 0; 134 return 0;
137} 135}
138 136
139int KOWhatsNextView::currentDateCount() 137int KOWhatsNextView::currentDateCount()
140{ 138{
141 return 0; 139 return 0;
142} 140}
143 141
144QPtrList<Incidence> KOWhatsNextView::selectedIncidences() 142QPtrList<Incidence> KOWhatsNextView::selectedIncidences()
145{ 143{
146 QPtrList<Incidence> eventList; 144 QPtrList<Incidence> eventList;
147 145
148 return eventList; 146 return eventList;
149} 147}
150 148
151void KOWhatsNextView::printMe() 149void KOWhatsNextView::printMe()
152{ 150{
153#ifdef DESKTOP_VERSION 151#ifdef DESKTOP_VERSION
diff --git a/korganizer/ktimeedit.cpp b/korganizer/ktimeedit.cpp
index 61a0931..df9b2fc 100644
--- a/korganizer/ktimeedit.cpp
+++ b/korganizer/ktimeedit.cpp
@@ -276,140 +276,138 @@ void KOTimeEdit::keyPressEvent(QKeyEvent *e)
276 else 276 else
277 if ( e->state () == Qt::ShiftButton ) { 277 if ( e->state () == Qt::ShiftButton ) {
278 subTime(QTime(1,0,0), false ); 278 subTime(QTime(1,0,0), false );
279 lineEdit()->setCursorPosition(0); 279 lineEdit()->setCursorPosition(0);
280 setSelect( 0 , 2 ); 280 setSelect( 0 , 2 );
281 } 281 }
282 else 282 else
283 // switch time down, cursor location depend 283 // switch time down, cursor location depend
284 switch (cpos) { 284 switch (cpos) {
285 case 7: 285 case 7:
286 case 6: 286 case 6:
287 case 5: 287 case 5:
288 if(!hour12Format) { 288 if(!hour12Format) {
289 lineEdit()->setCursorPosition(cpos = 4); 289 lineEdit()->setCursorPosition(cpos = 4);
290 } else { 290 } else {
291 subTime(QTime(12,0,0), false ); 291 subTime(QTime(12,0,0), false );
292 setSelect ( 5 , 2 ); 292 setSelect ( 5 , 2 );
293 break; 293 break;
294 } 294 }
295 case 4: 295 case 4:
296 subTime(QTime(0,1,0), false ); 296 subTime(QTime(0,1,0), false );
297 setSelect ( cpos , 1 ); 297 setSelect ( cpos , 1 );
298 break; 298 break;
299 case 3: 299 case 3:
300 subTime(QTime(0,10,0), false ); 300 subTime(QTime(0,10,0), false );
301 setSelect ( cpos , 1 ); 301 setSelect ( cpos , 1 );
302 break; 302 break;
303 case 2: 303 case 2:
304 lineEdit()->setCursorPosition(--cpos); 304 lineEdit()->setCursorPosition(--cpos);
305 case 1: 305 case 1:
306 case 0: 306 case 0:
307 subTime(QTime(1,0,0), false ); 307 subTime(QTime(1,0,0), false );
308 setSelect ( 0 , 2 ); 308 setSelect ( 0 , 2 );
309 break; 309 break;
310 } 310 }
311 break; 311 break;
312 // set cursor to correct place 312 // set cursor to correct place
313 case Key_Left: 313 case Key_Left:
314 if ( cpos == 3 ) 314 if ( cpos == 3 )
315 --cpos; 315 --cpos;
316 if ( cpos > 0) { 316 if ( cpos > 0) {
317 lineEdit()->setCursorPosition(--cpos); 317 lineEdit()->setCursorPosition(--cpos);
318 setSelect ( cpos , 1 ); 318 setSelect ( cpos , 1 );
319 } 319 }
320 else 320 else
321 setSelect ( 0 , 1 ); 321 setSelect ( 0 , 1 );
322 break; 322 break;
323 // set cursor to correct place 323 // set cursor to correct place
324 case Key_Right: 324 case Key_Right:
325 if ( cpos == 1 ) 325 if ( cpos == 1 )
326 ++cpos; 326 ++cpos;
327 if ( cpos < maxpos ) { 327 if ( cpos < maxpos ) {
328 lineEdit()->setCursorPosition(++cpos); 328 lineEdit()->setCursorPosition(++cpos);
329 setSelect ( cpos , 1 ); 329 setSelect ( cpos , 1 );
330 } 330 }
331 break; 331 break;
332 // rest 332 // rest
333 case Key_Prior: 333 case Key_Prior:
334 subTime(QTime(1,0,0)); 334 subTime(QTime(1,0,0));
335 break; 335 break;
336 case Key_Next: 336 case Key_Next:
337 addTime(QTime(1,0,0)); 337 addTime(QTime(1,0,0));
338 break; 338 break;
339 case Key_Backspace: 339 case Key_Backspace:
340 qDebug("+++++++++++back ");
341 if ( cpos > 0) { 340 if ( cpos > 0) {
342 if ( cpos == 3 ) 341 if ( cpos == 3 )
343 --cpos; 342 --cpos;
344 if ( cpos > 5) 343 if ( cpos > 5)
345 cpos = 5; 344 cpos = 5;
346 text.at( cpos-1 ) = '0'; 345 text.at( cpos-1 ) = '0';
347 lineEdit()->setText( text ); 346 lineEdit()->setText( text );
348 lineEdit()->setCursorPosition(--cpos); 347 lineEdit()->setCursorPosition(--cpos);
349 setSelect ( cpos , 1 ); 348 setSelect ( cpos , 1 );
350 changedText(); 349 changedText();
351 qDebug("---------back ");
352 } 350 }
353 break; 351 break;
354 } // switch arrows 352 } // switch arrows
355 353
356 // if cursor at string end, alltext market and keyEvent don't ArrowLeft -> deselect and cpos 354 // if cursor at string end, alltext market and keyEvent don't ArrowLeft -> deselect and cpos
357 if( cpos > 4 && lineEdit()->markedText().length() == 5 && e->key() != Key_Left ) { 355 if( cpos > 4 && lineEdit()->markedText().length() == 5 && e->key() != Key_Left ) {
358 lineEdit()->deselect(); 356 lineEdit()->deselect();
359 cpos = 0; 357 cpos = 0;
360 lineEdit()->setCursorPosition(cpos); 358 lineEdit()->setCursorPosition(cpos);
361 setSelect(cpos , 1); 359 setSelect(cpos , 1);
362 } 360 }
363 361
364 if ( cpos == 2 ) { 362 if ( cpos == 2 ) {
365 lineEdit()->setCursorPosition(++cpos); 363 lineEdit()->setCursorPosition(++cpos);
366 } 364 }
367 365
368 // num keys when cursorPos preEnd 366 // num keys when cursorPos preEnd
369 if ( cpos < 5 ) { 367 if ( cpos < 5 ) {
370 // switch another keys 368 // switch another keys
371 switch(e->key()) { 369 switch(e->key()) {
372 case Key_Delete: 370 case Key_Delete:
373 text.at( cpos ) = '0'; 371 text.at( cpos ) = '0';
374 lineEdit()->setText( text ); 372 lineEdit()->setText( text );
375 lineEdit()->setCursorPosition(cpos); 373 lineEdit()->setCursorPosition(cpos);
376 setSelect ( cpos , 1 ); 374 setSelect ( cpos , 1 );
377 changedText(); 375 changedText();
378 break; 376 break;
379 case Key_9: 377 case Key_9:
380 case Key_8: 378 case Key_8:
381 case Key_7: 379 case Key_7:
382 case Key_6: 380 case Key_6:
383 if ( !(cpos == 1 || cpos == 4) ) 381 if ( !(cpos == 1 || cpos == 4) )
384 return; 382 return;
385 if ( cpos == 1 && text.at( 0 ) > '1') 383 if ( cpos == 1 && text.at( 0 ) > '1')
386 text.at( 0 ) = '1'; 384 text.at( 0 ) = '1';
387 case Key_5: 385 case Key_5:
388 case Key_4: 386 case Key_4:
389 case Key_3: 387 case Key_3:
390 if ( cpos < 1 ) 388 if ( cpos < 1 )
391 return; 389 return;
392 if ( hour12Format && cpos == 1 ) 390 if ( hour12Format && cpos == 1 )
393 return; 391 return;
394 case Key_2: 392 case Key_2:
395 if ( hour12Format && cpos == 0 ) 393 if ( hour12Format && cpos == 0 )
396 return; 394 return;
397 if ( cpos == 0 && text.at( 1 ) > '3') 395 if ( cpos == 0 && text.at( 1 ) > '3')
398 text.at( 1 ) = '3'; 396 text.at( 1 ) = '3';
399 case Key_1: 397 case Key_1:
400 case Key_0: 398 case Key_0:
401 if ( hour12Format ) { 399 if ( hour12Format ) {
402 if ( e->key() == Key_0 && cpos == 1 && text.at( 0 ) == '0' ) 400 if ( e->key() == Key_0 && cpos == 1 && text.at( 0 ) == '0' )
403 return; 401 return;
404 if ( e->key() == Key_0 && cpos == 0 && text.at( 1 ) == '0' ) 402 if ( e->key() == Key_0 && cpos == 0 && text.at( 1 ) == '0' )
405 text.at( 1 ) = '1'; 403 text.at( 1 ) = '1';
406 } 404 }
407 text.at( cpos ) = QChar ( e->key() ); 405 text.at( cpos ) = QChar ( e->key() );
408 lineEdit()->setText( text ); 406 lineEdit()->setText( text );
409 if ( cpos == 1 ) 407 if ( cpos == 1 )
410 ++cpos; 408 ++cpos;
411 if ( cpos < 5) 409 if ( cpos < 5)
412 lineEdit()->setCursorPosition(++cpos); 410 lineEdit()->setCursorPosition(++cpos);
413 setSelect( cpos , 1 ); 411 setSelect( cpos , 1 );
414 changedText(); 412 changedText();
415 break; 413 break;
diff --git a/korganizer/mainwindow.cpp b/korganizer/mainwindow.cpp
index 8e5d108..95bef66 100644
--- a/korganizer/mainwindow.cpp
+++ b/korganizer/mainwindow.cpp
@@ -1,127 +1,126 @@
1#include <stdlib.h> 1#include <stdlib.h>
2 2
3#include <qaction.h> 3#include <qaction.h>
4#include <qpopupmenu.h> 4#include <qpopupmenu.h>
5#include <qpainter.h> 5#include <qpainter.h>
6#include <qwhatsthis.h> 6#include <qwhatsthis.h>
7#include <qpushbutton.h> 7#include <qpushbutton.h>
8#include <qmessagebox.h> 8#include <qmessagebox.h>
9#include <qlineedit.h> 9#include <qlineedit.h>
10#include <qtextcodec.h> 10#include <qtextcodec.h>
11#include <qfile.h> 11#include <qfile.h>
12#include <qdir.h> 12#include <qdir.h>
13#include <qapp.h> 13#include <qapp.h>
14#include <qfileinfo.h> 14#include <qfileinfo.h>
15#include <qlabel.h> 15#include <qlabel.h>
16#include <qspinbox.h> 16#include <qspinbox.h>
17#include <qcheckbox.h> 17#include <qcheckbox.h>
18#include <qmap.h> 18#include <qmap.h>
19#include <qwmatrix.h> 19#include <qwmatrix.h>
20#include <qtextbrowser.h> 20#include <qtextbrowser.h>
21#include <qtextstream.h> 21#include <qtextstream.h>
22#ifndef DESKTOP_VERSION 22#ifndef DESKTOP_VERSION
23#include <qpe/global.h> 23#include <qpe/global.h>
24#include <qpe/qpemenubar.h> 24#include <qpe/qpemenubar.h>
25#include <qpe/qpetoolbar.h> 25#include <qpe/qpetoolbar.h>
26#include <qpe/resource.h> 26#include <qpe/resource.h>
27#include <qpe/qpeapplication.h> 27#include <qpe/qpeapplication.h>
28#include <qtopia/alarmserver.h> 28#include <qtopia/alarmserver.h>
29#include <qtopia/qcopenvelope_qws.h> 29#include <qtopia/qcopenvelope_qws.h>
30#include <unistd.h> // for sleep 30#include <unistd.h> // for sleep
31#else 31#else
32#include <qmenubar.h> 32#include <qmenubar.h>
33#include <qtoolbar.h> 33#include <qtoolbar.h>
34#include <qapplication.h> 34#include <qapplication.h>
35//#include <resource.h> 35//#include <resource.h>
36 36
37#endif 37#endif
38#include <libkcal/calendarlocal.h> 38#include <libkcal/calendarlocal.h>
39#include <libkcal/todo.h> 39#include <libkcal/todo.h>
40#include <libkcal/phoneformat.h> 40#include <libkcal/phoneformat.h>
41#include <libkdepim/ksyncprofile.h> 41#include <libkdepim/ksyncprofile.h>
42#include <libkdepim/phoneaccess.h> 42#include <libkdepim/phoneaccess.h>
43#include <libkcal/kincidenceformatter.h> 43#include <libkcal/kincidenceformatter.h>
44#include <libkdepim/kpimglobalprefs.h> 44#include <libkdepim/kpimglobalprefs.h>
45 45
46#include "calendarview.h" 46#include "calendarview.h"
47#include "koviewmanager.h" 47#include "koviewmanager.h"
48#include "datenavigator.h" 48#include "datenavigator.h"
49#include "koagendaview.h" 49#include "koagendaview.h"
50#include "koagenda.h" 50#include "koagenda.h"
51#include "kodialogmanager.h" 51#include "kodialogmanager.h"
52#include "kdialogbase.h" 52#include "kdialogbase.h"
53#include "kapplication.h" 53#include "kapplication.h"
54#include "kofilterview.h" 54#include "kofilterview.h"
55#include "kstandarddirs.h" 55#include "kstandarddirs.h"
56#include "koprefs.h" 56#include "koprefs.h"
57#include "kfiledialog.h" 57#include "kfiledialog.h"
58#include "koglobals.h" 58#include "koglobals.h"
59#include "kglobal.h" 59#include "kglobal.h"
60#include "ktoolbar.h" 60#include "ktoolbar.h"
61#include "klocale.h" 61#include "klocale.h"
62#include "kconfig.h" 62#include "kconfig.h"
63#include "simplealarmclient.h"
64#include "externalapphandler.h" 63#include "externalapphandler.h"
65 64
66using namespace KCal; 65using namespace KCal;
67#ifndef _WIN32_ 66#ifndef _WIN32_
68#include <unistd.h> 67#include <unistd.h>
69#else 68#else
70#ifdef _OL_IMPORT_ 69#ifdef _OL_IMPORT_
71#include "koimportoldialog.h" 70#include "koimportoldialog.h"
72#endif 71#endif
73#endif 72#endif
74#include "mainwindow.h" 73#include "mainwindow.h"
75 74
76 75
77class KOex2phonePrefs : public QDialog 76class KOex2phonePrefs : public QDialog
78{ 77{
79 public: 78 public:
80 KOex2phonePrefs( QWidget *parent=0, const char *name=0 ) : 79 KOex2phonePrefs( QWidget *parent=0, const char *name=0 ) :
81 QDialog( parent, name, true ) 80 QDialog( parent, name, true )
82 { 81 {
83 setCaption( i18n("Export to phone options") ); 82 setCaption( i18n("Export to phone options") );
84 QVBoxLayout* lay = new QVBoxLayout( this ); 83 QVBoxLayout* lay = new QVBoxLayout( this );
85 lay->setSpacing( 3 ); 84 lay->setSpacing( 3 );
86 lay->setMargin( 3 ); 85 lay->setMargin( 3 );
87 QLabel *lab; 86 QLabel *lab;
88 lay->addWidget(lab = new QLabel( i18n("Please read Help-Sync Howto\nto know what settings to use."), this ) ); 87 lay->addWidget(lab = new QLabel( i18n("Please read Help-Sync Howto\nto know what settings to use."), this ) );
89 lab->setAlignment (AlignHCenter ); 88 lab->setAlignment (AlignHCenter );
90 QHBox* temphb; 89 QHBox* temphb;
91 temphb = new QHBox( this ); 90 temphb = new QHBox( this );
92 new QLabel( i18n("I/O device: "), temphb ); 91 new QLabel( i18n("I/O device: "), temphb );
93 mPhoneDevice = new QLineEdit( temphb); 92 mPhoneDevice = new QLineEdit( temphb);
94 lay->addWidget( temphb ); 93 lay->addWidget( temphb );
95 temphb = new QHBox( this ); 94 temphb = new QHBox( this );
96 new QLabel( i18n("Connection: "), temphb ); 95 new QLabel( i18n("Connection: "), temphb );
97 mPhoneConnection = new QLineEdit( temphb); 96 mPhoneConnection = new QLineEdit( temphb);
98 lay->addWidget( temphb ); 97 lay->addWidget( temphb );
99 temphb = new QHBox( this ); 98 temphb = new QHBox( this );
100 new QLabel( i18n("Model(opt.): "), temphb ); 99 new QLabel( i18n("Model(opt.): "), temphb );
101 mPhoneModel = new QLineEdit( temphb); 100 mPhoneModel = new QLineEdit( temphb);
102 lay->addWidget( temphb ); 101 lay->addWidget( temphb );
103 mWriteBackFuture= new QCheckBox( i18n("Write back events in future only"), this ); 102 mWriteBackFuture= new QCheckBox( i18n("Write back events in future only"), this );
104 mWriteBackFuture->setChecked( true ); 103 mWriteBackFuture->setChecked( true );
105 lay->addWidget( mWriteBackFuture ); 104 lay->addWidget( mWriteBackFuture );
106 temphb = new QHBox( this ); 105 temphb = new QHBox( this );
107 new QLabel( i18n("Max. weeks in future: ") , temphb ); 106 new QLabel( i18n("Max. weeks in future: ") , temphb );
108 mWriteBackFutureWeeks= new QSpinBox(1,104, 1, temphb); 107 mWriteBackFutureWeeks= new QSpinBox(1,104, 1, temphb);
109 mWriteBackFutureWeeks->setValue( 8 ); 108 mWriteBackFutureWeeks->setValue( 8 );
110 lay->addWidget( temphb ); 109 lay->addWidget( temphb );
111 lay->addWidget(lab = new QLabel( i18n("NOTE: This will remove all old\ntodo/calendar data on phone!"), this ) ); 110 lay->addWidget(lab = new QLabel( i18n("NOTE: This will remove all old\ntodo/calendar data on phone!"), this ) );
112 lab->setAlignment (AlignHCenter ); 111 lab->setAlignment (AlignHCenter );
113 QPushButton * ok = new QPushButton( i18n("Export to mobile phone!"), this ); 112 QPushButton * ok = new QPushButton( i18n("Export to mobile phone!"), this );
114 lay->addWidget( ok ); 113 lay->addWidget( ok );
115 QPushButton * cancel = new QPushButton( i18n("Cancel"), this ); 114 QPushButton * cancel = new QPushButton( i18n("Cancel"), this );
116 lay->addWidget( cancel ); 115 lay->addWidget( cancel );
117 connect ( ok,SIGNAL(clicked() ),this , SLOT ( accept() ) ); 116 connect ( ok,SIGNAL(clicked() ),this , SLOT ( accept() ) );
118 connect (cancel, SIGNAL(clicked() ), this, SLOT ( reject()) ); 117 connect (cancel, SIGNAL(clicked() ), this, SLOT ( reject()) );
119 resize( 220, 240 ); 118 resize( 220, 240 );
120 qApp->processEvents(); 119 qApp->processEvents();
121 int dw = QApplication::desktop()->width(); 120 int dw = QApplication::desktop()->width();
122 int dh = QApplication::desktop()->height(); 121 int dh = QApplication::desktop()->height();
123 move( (dw-width())/2, (dh - height() )/2 ); 122 move( (dw-width())/2, (dh - height() )/2 );
124 } 123 }
125 124
126public: 125public:
127 QLineEdit* mPhoneConnection, *mPhoneDevice, *mPhoneModel; 126 QLineEdit* mPhoneConnection, *mPhoneDevice, *mPhoneModel;
@@ -224,129 +223,128 @@ MainWindow::MainWindow( QWidget *parent, const char *name, QString msg) :
224 if ( p->mToolBarUpV ) 223 if ( p->mToolBarUpV )
225 tbd = Right; 224 tbd = Right;
226 else 225 else
227 tbd = Left; 226 tbd = Left;
228 } 227 }
229 viewToolBar = new QPEToolBar( this ); 228 viewToolBar = new QPEToolBar( this );
230 addToolBar (viewToolBar , tbd ); 229 addToolBar (viewToolBar , tbd );
231 if ( p->mToolBarHorN ) { 230 if ( p->mToolBarHorN ) {
232 if ( p->mToolBarUpN ) 231 if ( p->mToolBarUpN )
233 tbd = Bottom; 232 tbd = Bottom;
234 else 233 else
235 tbd = Top; 234 tbd = Top;
236 } 235 }
237 else { 236 else {
238 if ( p->mToolBarUpN ) 237 if ( p->mToolBarUpN )
239 tbd = Right; 238 tbd = Right;
240 else 239 else
241 tbd = Left; 240 tbd = Left;
242 } 241 }
243 navigatorToolBar = new QPEToolBar( this ); 242 navigatorToolBar = new QPEToolBar( this );
244 addToolBar (navigatorToolBar , tbd ); 243 addToolBar (navigatorToolBar , tbd );
245 } 244 }
246 245
247 246
248 247
249 mCalendarModifiedFlag = false; 248 mCalendarModifiedFlag = false;
250 QLabel* splash = new QLabel(i18n("KO/Pi is starting ... "), this ); 249 QLabel* splash = new QLabel(i18n("KO/Pi is starting ... "), this );
251 splash->setAlignment ( AlignCenter ); 250 splash->setAlignment ( AlignCenter );
252 setCentralWidget( splash ); 251 setCentralWidget( splash );
253#ifndef DESKTOP_VERSION 252#ifndef DESKTOP_VERSION
254 showMaximized(); 253 showMaximized();
255#endif 254#endif
256 255
257 //qDebug("Mainwidget x %d y %d w %d h %d", x(), y(), width(), height ()); 256 //qDebug("Mainwidget x %d y %d w %d h %d", x(), y(), width(), height ());
258 setDefaultPreferences(); 257 setDefaultPreferences();
259 mCalendar = new CalendarLocal(); 258 mCalendar = new CalendarLocal();
260 mView = new CalendarView( mCalendar, this,"mCalendar " ); 259 mView = new CalendarView( mCalendar, this,"mCalendar " );
261 mView->hide(); 260 mView->hide();
262 //mView->resize(splash->size() ); 261 //mView->resize(splash->size() );
263 initActions(); 262 initActions();
264 mSyncManager = new KSyncManager((QWidget*)this, (KSyncInterface*)mView, KSyncManager::KOPI, KOPrefs::instance(), syncMenu); 263 mSyncManager = new KSyncManager((QWidget*)this, (KSyncInterface*)mView, KSyncManager::KOPI, KOPrefs::instance(), syncMenu);
265 mSyncManager->setBlockSave(false); 264 mSyncManager->setBlockSave(false);
266 mView->setSyncManager(mSyncManager); 265 mView->setSyncManager(mSyncManager);
267#ifndef DESKTOP_VERSION 266#ifndef DESKTOP_VERSION
268 iconToolBar->show(); 267 iconToolBar->show();
269 qApp->processEvents(); 268 qApp->processEvents();
270#endif 269#endif
271 //qDebug("Splashwidget x %d y %d w %d h %d", splash-> x(), splash->y(), splash->width(),splash-> height ()); 270 //qDebug("Splashwidget x %d y %d w %d h %d", splash-> x(), splash->y(), splash->width(),splash-> height ());
272 int vh = height() ; 271 int vh = height() ;
273 int vw = width(); 272 int vw = width();
274 //qDebug("Toolbar hei %d ",iconToolBar->height() ); 273 //qDebug("Toolbar hei %d ",iconToolBar->height() );
275 if ( iconToolBar->orientation () == Qt:: Horizontal ) { 274 if ( iconToolBar->orientation () == Qt:: Horizontal ) {
276 vh -= iconToolBar->height(); 275 vh -= iconToolBar->height();
277 } else { 276 } else {
278 vw -= iconToolBar->height(); 277 vw -= iconToolBar->height();
279 } 278 }
280 //mView->setMaximumSize( splash->size() ); 279 //mView->setMaximumSize( splash->size() );
281 //mView->resize( splash->size() ); 280 //mView->resize( splash->size() );
282 //qDebug("MainView x %d y %d w %d h %d", mView->x(),mView-> y(), mView->width(), mView->height ()); 281 //qDebug("MainView x %d y %d w %d h %d", mView->x(),mView-> y(), mView->width(), mView->height ());
283 mView->readSettings(); 282 mView->readSettings();
284 bool newFile = false; 283 bool newFile = false;
285 if( !QFile::exists( defaultFileName() ) ) { 284 if( !QFile::exists( defaultFileName() ) ) {
286 QFileInfo finfo ( defaultFileName() ); 285 QFileInfo finfo ( defaultFileName() );
287 QString oldFile = QDir::convertSeparators( QDir::homeDirPath()+"/Applications/korganizer/mycalendar.ics"); 286 QString oldFile = QDir::convertSeparators( QDir::homeDirPath()+"/Applications/korganizer/mycalendar.ics");
288 qDebug("oldfile %s ", oldFile.latin1());
289 QString message = "You are starting KO/Pi for the\nfirst time after updating to a\nversion >= 1.9.1. The location of the\ndefault calendar file has changed.\nA mycalendar.ics file was detected\nat the old location.\nThis file will be loaded now\nand stored at the new location!\n(Config file location has changed, too!)\nPlease read menu Help-What's New!\n"; 287 QString message = "You are starting KO/Pi for the\nfirst time after updating to a\nversion >= 1.9.1. The location of the\ndefault calendar file has changed.\nA mycalendar.ics file was detected\nat the old location.\nThis file will be loaded now\nand stored at the new location!\n(Config file location has changed, too!)\nPlease read menu Help-What's New!\n";
290 finfo.setFile( oldFile ); 288 finfo.setFile( oldFile );
291 if (finfo.exists() ) { 289 if (finfo.exists() ) {
292 KMessageBox::information( this, message); 290 KMessageBox::information( this, message);
293 mView->openCalendar( oldFile ); 291 mView->openCalendar( oldFile );
294 qApp->processEvents(); 292 qApp->processEvents();
295 } else { 293 } else {
296 oldFile = QDir::convertSeparators( QDir::homeDirPath()+"/korganizer/mycalendar.ics"); 294 oldFile = QDir::convertSeparators( QDir::homeDirPath()+"/korganizer/mycalendar.ics");
297 finfo.setFile( oldFile ); 295 finfo.setFile( oldFile );
298 if (finfo.exists() ) { 296 if (finfo.exists() ) {
299 KMessageBox::information( this, message); 297 KMessageBox::information( this, message);
300 mView->openCalendar( oldFile ); 298 mView->openCalendar( oldFile );
301 qApp->processEvents(); 299 qApp->processEvents();
302 } 300 }
303 } 301 }
304 mView->saveCalendar( defaultFileName() ); 302 mView->saveCalendar( defaultFileName() );
305 newFile = true; 303 newFile = true;
306 } 304 }
307 305
308 QTime neededSaveTime = QDateTime::currentDateTime().time(); 306 QTime neededSaveTime = QDateTime::currentDateTime().time();
309 mView->openCalendar( defaultFileName() ); 307 mView->openCalendar( defaultFileName() );
310 int msNeeded = neededSaveTime.msecsTo( QDateTime::currentDateTime().time() ); 308 int msNeeded = neededSaveTime.msecsTo( QDateTime::currentDateTime().time() );
311 qDebug("KO: Calendar loading time: %d ms",msNeeded ); 309 qDebug("KO: Calendar loading time: %d ms",msNeeded );
312 310
313 if ( KPimGlobalPrefs::instance()->mPreferredLanguage != KOPrefs::instance()->mOldLoadedLanguage ) { 311 if ( KPimGlobalPrefs::instance()->mPreferredLanguage != KOPrefs::instance()->mOldLoadedLanguage ) {
314 KOPrefs::instance()->setAllDefaults(); 312 KOPrefs::instance()->setAllDefaults();
315 int count = mView->addCategories(); 313 int count = mView->addCategories();
316 } 314 }
317 processIncidenceSelection( 0 ); 315 processIncidenceSelection( 0 );
318 connect( mView, SIGNAL( incidenceSelected( Incidence * ) ), 316 connect( mView, SIGNAL( incidenceSelected( Incidence * ) ),
319 SLOT( processIncidenceSelection( Incidence * ) ) ); 317 SLOT( processIncidenceSelection( Incidence * ) ) );
320 connect( mView, SIGNAL( modifiedChanged( bool ) ), 318 connect( mView, SIGNAL( modifiedChanged( bool ) ),
321 SLOT( slotModifiedChanged( bool ) ) ); 319 SLOT( slotModifiedChanged( bool ) ) );
322 320
323 321
324 connect( mView, SIGNAL( tempDisableBR(bool) ), 322 connect( mView, SIGNAL( tempDisableBR(bool) ),
325 SLOT( disableBR(bool) ) ); 323 SLOT( disableBR(bool) ) );
326 connect( &mSaveTimer, SIGNAL( timeout() ), SLOT( save() ) ); 324 connect( &mSaveTimer, SIGNAL( timeout() ), SLOT( save() ) );
327 mView->setModified( false ); 325 mView->setModified( false );
328 mBlockAtStartup = false; 326 mBlockAtStartup = false;
329 mView->setModified( false ); 327 mView->setModified( false );
330 setCentralWidget( mView ); 328 setCentralWidget( mView );
331 globalFlagBlockStartup = 0; 329 globalFlagBlockStartup = 0;
332 mView->show(); 330 mView->show();
333 delete splash; 331 delete splash;
334 if ( newFile ) 332 if ( newFile )
335 mView->updateConfig(); 333 mView->updateConfig();
336 // qApp->processEvents(); 334 // qApp->processEvents();
337 //qDebug("MainView x %d y %d w %d h %d", mView->x(),mView-> y(), mView->width(), mView->height ()); 335 //qDebug("MainView x %d y %d w %d h %d", mView->x(),mView-> y(), mView->width(), mView->height ());
338 //fillSyncMenu(); 336 //fillSyncMenu();
339 337
340 338
341 connect(mSyncManager , SIGNAL( save() ), this, SLOT( save() ) ); 339 connect(mSyncManager , SIGNAL( save() ), this, SLOT( save() ) );
342 connect(mView , SIGNAL( save() ), this, SLOT( save() ) ); 340 connect(mView , SIGNAL( save() ), this, SLOT( save() ) );
343 connect(mView , SIGNAL( saveStopTimer() ), this, SLOT( saveStopTimer() ) ); 341 connect(mView , SIGNAL( saveStopTimer() ), this, SLOT( saveStopTimer() ) );
344 connect(mSyncManager , SIGNAL( request_file() ), this, SLOT( syncFileRequest() ) ); 342 connect(mSyncManager , SIGNAL( request_file() ), this, SLOT( syncFileRequest() ) );
345 connect(mSyncManager , SIGNAL( getFile( bool )), this, SLOT(getFile( bool ) ) ); 343 connect(mSyncManager , SIGNAL( getFile( bool )), this, SLOT(getFile( bool ) ) );
346 mSyncManager->setDefaultFileName( sentSyncFile()); 344 mSyncManager->setDefaultFileName( sentSyncFile());
347 connect ( syncMenu, SIGNAL( activated ( int ) ), mSyncManager, SLOT (slotSyncMenu( int ) ) ); 345 connect ( syncMenu, SIGNAL( activated ( int ) ), mSyncManager, SLOT (slotSyncMenu( int ) ) );
348 mSyncManager->fillSyncMenu(); 346 mSyncManager->fillSyncMenu();
349 347
350 348
351 349
352 mView->viewManager()->agendaView()->setStartHour( KOPrefs::instance()->mDayBegins ); 350 mView->viewManager()->agendaView()->setStartHour( KOPrefs::instance()->mDayBegins );
@@ -357,135 +355,135 @@ MainWindow::MainWindow( QWidget *parent, const char *name, QString msg) :
357 mView->dialogManager()->showSyncOptions(); 355 mView->dialogManager()->showSyncOptions();
358 } 356 }
359 357
360 //US listen for result adressed from Ka/Pi 358 //US listen for result adressed from Ka/Pi
361#ifndef DESKTOP_VERSION 359#ifndef DESKTOP_VERSION
362 connect(qApp, SIGNAL (appMessage ( const QCString &, const QByteArray & )), ExternalAppHandler::instance(), SLOT (appMessage ( const QCString &, const QByteArray & ))); 360 connect(qApp, SIGNAL (appMessage ( const QCString &, const QByteArray & )), ExternalAppHandler::instance(), SLOT (appMessage ( const QCString &, const QByteArray & )));
363#endif 361#endif
364#ifndef DESKTOP_VERSION 362#ifndef DESKTOP_VERSION
365 infrared = 0; 363 infrared = 0;
366#endif 364#endif
367 updateFilterToolbar(); 365 updateFilterToolbar();
368 updateWeek( mView->startDate() ); 366 updateWeek( mView->startDate() );
369 connect( mView->dateNavigator(), SIGNAL( datesSelected( const KCal::DateList & ) ), 367 connect( mView->dateNavigator(), SIGNAL( datesSelected( const KCal::DateList & ) ),
370 SLOT( updateWeekNum( const KCal::DateList & ) ) ); 368 SLOT( updateWeekNum( const KCal::DateList & ) ) );
371 mBRdisabled = false; 369 mBRdisabled = false;
372 //toggleBeamReceive(); 370 //toggleBeamReceive();
373} 371}
374MainWindow::~MainWindow() 372MainWindow::~MainWindow()
375{ 373{
376 //qDebug("MainWindow::~MainWindow() "); 374 //qDebug("MainWindow::~MainWindow() ");
377 //save toolbar location 375 //save toolbar location
378 delete mCalendar; 376 delete mCalendar;
379 delete mSyncManager; 377 delete mSyncManager;
380#ifndef DESKTOP_VERSION 378#ifndef DESKTOP_VERSION
381 if ( infrared ) 379 if ( infrared )
382 delete infrared; 380 delete infrared;
383#endif 381#endif
384 382
385 383
386} 384}
387 385
388void MainWindow::disableBR(bool b) 386void MainWindow::disableBR(bool b)
389{ 387{
390#ifndef DESKTOP_VERSION 388#ifndef DESKTOP_VERSION
391 if ( b ) { 389 if ( b ) {
392 if ( infrared ) { 390 if ( infrared ) {
393 toggleBeamReceive(); 391 toggleBeamReceive();
394 mBRdisabled = true; 392 mBRdisabled = true;
395 } 393 }
396 mBRdisabled = true; 394 mBRdisabled = true;
397 } else { 395 } else {
398 if ( mBRdisabled ) { 396 if ( mBRdisabled ) {
399 mBRdisabled = false; 397 mBRdisabled = false;
400 //makes no sense,because other cal ap is probably running 398 //makes no sense,because other cal ap is probably running
401 // toggleBeamReceive(); 399 // toggleBeamReceive();
402 } 400 }
403 } 401 }
404#endif 402#endif
405 403
406} 404}
407bool MainWindow::beamReceiveEnabled() 405bool MainWindow::beamReceiveEnabled()
408{ 406{
409#ifndef DESKTOP_VERSION 407#ifndef DESKTOP_VERSION
410 return ( infrared != 0 ); 408 return ( infrared != 0 );
411#endif 409#endif
412 return false; 410 return false;
413} 411}
414 412
415void MainWindow::toggleBeamReceive() 413void MainWindow::toggleBeamReceive()
416{ 414{
417 if ( mBRdisabled ) 415 if ( mBRdisabled )
418 return; 416 return;
419#ifndef DESKTOP_VERSION 417#ifndef DESKTOP_VERSION
420 if ( infrared ) { 418 if ( infrared ) {
421 qDebug("disable BeamReceive "); 419 qDebug("KO: Disable BeamReceive ");
422 delete infrared; 420 delete infrared;
423 infrared = 0; 421 infrared = 0;
424 brAction->setOn(false); 422 brAction->setOn(false);
425 return; 423 return;
426 } 424 }
427 qDebug("enable BeamReceive "); 425 qDebug("KO: Enable BeamReceive ");
428 brAction->setOn(true); 426 brAction->setOn(true);
429 infrared = new QCopChannel("QPE/Application/datebook",this, "channel" ) ; 427 infrared = new QCopChannel("QPE/Application/datebook",this, "channel" ) ;
430 QObject::connect( infrared, SIGNAL (received ( const QCString &, const QByteArray & )),this, SLOT(recieve( const QCString&, const QByteArray& ))); 428 QObject::connect( infrared, SIGNAL (received ( const QCString &, const QByteArray & )),this, SLOT(recieve( const QCString&, const QByteArray& )));
431#endif 429#endif
432} 430}
433void MainWindow::showMaximized () 431void MainWindow::showMaximized ()
434{ 432{
435#ifndef DESKTOP_VERSION 433#ifndef DESKTOP_VERSION
436 if ( ! globalFlagBlockStartup ) 434 if ( ! globalFlagBlockStartup )
437 if ( mClosed ) 435 if ( mClosed )
438 mView->goToday(); 436 mView->goToday();
439#endif 437#endif
440 QWidget::showMaximized () ; 438 QWidget::showMaximized () ;
441 mClosed = false; 439 mClosed = false;
442} 440}
443void MainWindow::closeEvent( QCloseEvent* ce ) 441void MainWindow::closeEvent( QCloseEvent* ce )
444{ 442{
445 443
446 444
447 445
448 if ( ! KOPrefs::instance()->mAskForQuit ) { 446 if ( ! KOPrefs::instance()->mAskForQuit ) {
449 saveOnClose(); 447 saveOnClose();
450 mClosed = true; 448 mClosed = true;
451 ce->accept(); 449 ce->accept();
452 return; 450 return;
453 451
454 } 452 }
455 453
456 switch( QMessageBox::information( this, "KO/Pi", 454 switch( QMessageBox::information( this, "KO/Pi",
457 i18n("Do you really want\nto close KO/Pi?"), 455 i18n("Do you really want\nto close KO/Pi?"),
458 i18n("Close"), i18n("No"), 456 i18n("Close"), i18n("No"),
459 0, 0 ) ) { 457 0, 0 ) ) {
460 case 0: 458 case 0:
461 saveOnClose(); 459 saveOnClose();
462 mClosed = true; 460 mClosed = true;
463 ce->accept(); 461 ce->accept();
464 break; 462 break;
465 case 1: 463 case 1:
466 ce->ignore(); 464 ce->ignore();
467 break; 465 break;
468 case 2: 466 case 2:
469 467
470 default: 468 default:
471 break; 469 break;
472 } 470 }
473 471
474 472
475} 473}
476 474
477void MainWindow::recieve( const QCString& cmsg, const QByteArray& data ) 475void MainWindow::recieve( const QCString& cmsg, const QByteArray& data )
478{ 476{
479 QDataStream stream( data, IO_ReadOnly ); 477 QDataStream stream( data, IO_ReadOnly );
480 // QMessageBox::about( this, "About KOrganizer/Pi", "*" +msg +"*" ); 478 // QMessageBox::about( this, "About KOrganizer/Pi", "*" +msg +"*" );
481 //QString datamess; 479 //QString datamess;
482 //qDebug("message "); 480 //qDebug("message ");
483 qDebug("KO: QCOP message received: %s ", cmsg.data() ); 481 qDebug("KO: QCOP message received: %s ", cmsg.data() );
484 482
485 if ( cmsg == "setDocument(QString)" ) { 483 if ( cmsg == "setDocument(QString)" ) {
486 QDataStream stream( data, IO_ReadOnly ); 484 QDataStream stream( data, IO_ReadOnly );
487 QString fileName; 485 QString fileName;
488 stream >> fileName; 486 stream >> fileName;
489 //qDebug("filename %s ", fileName.latin1()); 487 //qDebug("filename %s ", fileName.latin1());
490 showMaximized(); 488 showMaximized();
491 raise(); 489 raise();
diff --git a/korganizer/mainwindow.h b/korganizer/mainwindow.h
index f2a6c60..45ed04d 100644
--- a/korganizer/mainwindow.h
+++ b/korganizer/mainwindow.h
@@ -1,175 +1,166 @@
1#ifndef KORGE_MAINWINDOW_H 1#ifndef KORGE_MAINWINDOW_H
2#define KORGE_MAINWINDOW_H 2#define KORGE_MAINWINDOW_H
3 3
4#include <qmainwindow.h> 4#include <qmainwindow.h>
5#include <qtimer.h> 5#include <qtimer.h>
6#include <qdict.h> 6#include <qdict.h>
7#include <qfile.h> 7#include <qfile.h>
8#include <qmenubar.h> 8#include <qmenubar.h>
9#include <qtextstream.h> 9#include <qtextstream.h>
10#include <qregexp.h> 10#include <qregexp.h>
11 11
12#include <libkcal/incidence.h> 12#include <libkcal/incidence.h>
13#include "simplealarmclient.h"
14#include <ksyncmanager.h> 13#include <ksyncmanager.h>
15#ifndef DESKTOP_VERSION 14#ifndef DESKTOP_VERSION
16#include <qcopchannel_qws.h> 15#include <qcopchannel_qws.h>
17#endif 16#endif
18class QAction; 17class QAction;
19class CalendarView; 18class CalendarView;
20class KSyncProfile; 19class KSyncProfile;
21#ifdef DESKTOP_VERSION 20#ifdef DESKTOP_VERSION
22 21
23#define QPEToolBar QToolBar 22#define QPEToolBar QToolBar
24#define QPEMenuBar QMenuBar 23#define QPEMenuBar QMenuBar
25#endif 24#endif
26class QPEToolBar; 25class QPEToolBar;
27class QPEMenuBar; 26class QPEMenuBar;
28 27
29 28
30namespace KCal { 29namespace KCal {
31class CalendarLocal; 30class CalendarLocal;
32} 31}
33 32
34class KOMenuBar : public QMenuBar
35{
36 public:
37 KOMenuBar( QWidget *parent=0 ): QMenuBar (parent ) {;}
38 QSize sizeHint () const{ qDebug("sizejint ");return QSize ( 40,25 );}
39};
40
41using namespace KCal; 33using namespace KCal;
42 34
43class MainWindow : public QMainWindow 35class MainWindow : public QMainWindow
44{ 36{
45 Q_OBJECT 37 Q_OBJECT
46 public: 38 public:
47 MainWindow( QWidget *parent = 0, const char *name = 0, QString command = ""); 39 MainWindow( QWidget *parent = 0, const char *name = 0, QString command = "");
48 ~MainWindow(); 40 ~MainWindow();
49 bool beamReceiveEnabled(); 41 bool beamReceiveEnabled();
50 static QString defaultFileName(); 42 static QString defaultFileName();
51 static QString syncFileName(); 43 static QString syncFileName();
52 static QString resourcePath(); 44 static QString resourcePath();
53 public slots: 45 public slots:
54 void setCaption ( const QString & ); 46 void setCaption ( const QString & );
55 void updateWeekNum(const KCal::DateList &); 47 void updateWeekNum(const KCal::DateList &);
56 void updateWeek(QDate); 48 void updateWeek(QDate);
57 void updateFilterToolbar(); 49 void updateFilterToolbar();
58 virtual void showMaximized (); 50 virtual void showMaximized ();
59 void configureAgenda( int ); 51 void configureAgenda( int );
60 void recieve( const QCString& msg, const QByteArray& data ); 52 void recieve( const QCString& msg, const QByteArray& data );
61 protected slots: 53 protected slots:
62 void setCaptionToDates(); 54 void setCaptionToDates();
63 void weekAction(); 55 void weekAction();
64 void about(); 56 void about();
65 void licence(); 57 void licence();
66 void faq(); 58 void faq();
67 void usertrans(); 59 void usertrans();
68 void features(); 60 void features();
69 void synchowto(); 61 void synchowto();
70 void storagehowto(); 62 void storagehowto();
71 void timetrackinghowto(); 63 void timetrackinghowto();
72 void kdesynchowto(); 64 void kdesynchowto();
73 void multisynchowto(); 65 void multisynchowto();
74 void whatsNew(); 66 void whatsNew();
75 void keyBindings(); 67 void keyBindings();
76 void aboutAutoSaving();; 68 void aboutAutoSaving();;
77 void aboutKnownBugs(); 69 void aboutKnownBugs();
78 70
79 void processIncidenceSelection( Incidence * ); 71 void processIncidenceSelection( Incidence * );
80 72
81 void importQtopia(); 73 void importQtopia();
82 void importBday(); 74 void importBday();
83 void importOL(); 75 void importOL();
84 void importIcal(); 76 void importIcal();
85 void importFile( QString, bool ); 77 void importFile( QString, bool );
86 void quickImportIcal(); 78 void quickImportIcal();
87 79
88 void slotModifiedChanged( bool ); 80 void slotModifiedChanged( bool );
89 81
90 void save(); 82 void save();
91 void saveStopTimer(); 83 void saveStopTimer();
92 void configureToolBar( int ); 84 void configureToolBar( int );
93 void printSel(); 85 void printSel();
94 void printCal(); 86 void printCal();
95 void saveCalendar(); 87 void saveCalendar();
96 void loadCalendar(); 88 void loadCalendar();
97 void exportVCalendar(); 89 void exportVCalendar();
98 void fillFilterMenu(); 90 void fillFilterMenu();
99 void fillFilterMenuTB(); 91 void fillFilterMenuTB();
100 void selectFilter( int ); 92 void selectFilter( int );
101 void fillFilterMenuPopup(); 93 void fillFilterMenuPopup();
102 void selectFilterPopup( int ); 94 void selectFilterPopup( int );
103 void exportToPhone( int ); 95 void exportToPhone( int );
104 void toggleBeamReceive(); 96 void toggleBeamReceive();
105 void disableBR(bool); 97 void disableBR(bool);
106 signals: 98 signals:
107 void selectWeek ( int ); 99 void selectWeek ( int );
108 private slots: 100 private slots:
109 void showConfigureAgenda(); 101 void showConfigureAgenda();
110 void getFile( bool ); 102 void getFile( bool );
111 void syncFileRequest(); 103 void syncFileRequest();
112 104
113 protected: 105 protected:
114 void hideEvent ( QHideEvent * ); 106 void hideEvent ( QHideEvent * );
115 QString sentSyncFile(); 107 QString sentSyncFile();
116 void displayText( QString, QString); 108 void displayText( QString, QString);
117 void enableIncidenceActions( bool ); 109 void enableIncidenceActions( bool );
118 110
119 private: 111 private:
120 bool mBRdisabled; 112 bool mBRdisabled;
121#ifndef DESKTOP_VERSION 113#ifndef DESKTOP_VERSION
122 QCopChannel* infrared; 114 QCopChannel* infrared;
123#endif 115#endif
124 QAction* brAction; 116 QAction* brAction;
125 KSyncManager* mSyncManager; 117 KSyncManager* mSyncManager;
126 bool mClosed; 118 bool mClosed;
127 void saveOnClose(); 119 void saveOnClose();
128 bool mFlagKeyPressed; 120 bool mFlagKeyPressed;
129 bool mBlockAtStartup; 121 bool mBlockAtStartup;
130 QPEToolBar *iconToolBar; 122 QPEToolBar *iconToolBar;
131 QPEToolBar *viewToolBar; 123 QPEToolBar *viewToolBar;
132 QPEToolBar *navigatorToolBar; 124 QPEToolBar *navigatorToolBar;
133 QPEToolBar *filterToolBar; 125 QPEToolBar *filterToolBar;
134 QPEMenuBar *filterMenubar; 126 QPEMenuBar *filterMenubar;
135 QPopupMenu * filterPopupMenu; 127 QPopupMenu * filterPopupMenu;
136 void initActions(); 128 void initActions();
137 void setDefaultPreferences(); 129 void setDefaultPreferences();
138 void resizeEvent( QResizeEvent* e); 130 void resizeEvent( QResizeEvent* e);
139 void keyPressEvent ( QKeyEvent * ) ; 131 void keyPressEvent ( QKeyEvent * ) ;
140 void keyReleaseEvent ( QKeyEvent * ) ; 132 void keyReleaseEvent ( QKeyEvent * ) ;
141 QPopupMenu *configureToolBarMenu; 133 QPopupMenu *configureToolBarMenu;
142 QPopupMenu *selectFilterMenu; 134 QPopupMenu *selectFilterMenu;
143 QPopupMenu *selectFilterMenuTB; 135 QPopupMenu *selectFilterMenuTB;
144 QPopupMenu *configureAgendaMenu, *syncMenu; 136 QPopupMenu *configureAgendaMenu, *syncMenu;
145 CalendarLocal *mCalendar; 137 CalendarLocal *mCalendar;
146 CalendarView *mView; 138 CalendarView *mView;
147 QAction *mNewSubTodoAction; 139 QAction *mNewSubTodoAction;
148 QAction *mWeekAction; 140 QAction *mWeekAction;
149 QFont mWeekFont; 141 QFont mWeekFont;
150 QPixmap mWeekPixmap; 142 QPixmap mWeekPixmap;
151 QColor mWeekBgColor; 143 QColor mWeekBgColor;
152 144
153 QAction *mShowAction; 145 QAction *mShowAction;
154 QAction *mEditAction; 146 QAction *mEditAction;
155 QAction *mDeleteAction; 147 QAction *mDeleteAction;
156 QAction *mCloneAction; 148 QAction *mCloneAction;
157 QAction *mMoveAction; 149 QAction *mMoveAction;
158 QAction *mBeamAction; 150 QAction *mBeamAction;
159 QAction *mCancelAction; 151 QAction *mCancelAction;
160 152
161 QAction *mToggleNav; 153 QAction *mToggleNav;
162 QAction *mToggleFilter; 154 QAction *mToggleFilter;
163 QAction *mToggleAllday; 155 QAction *mToggleAllday;
164 QAction *actionFilterMenuTB; 156 QAction *actionFilterMenuTB;
165 157
166 void closeEvent( QCloseEvent* ce ); 158 void closeEvent( QCloseEvent* ce );
167 SimpleAlarmClient mAlarmClient;
168 QTimer mSaveTimer; 159 QTimer mSaveTimer;
169 //bool mBlockSaveFlag; 160 //bool mBlockSaveFlag;
170 bool mCalendarModifiedFlag; 161 bool mCalendarModifiedFlag;
171 QPixmap loadPixmap( QString ); 162 QPixmap loadPixmap( QString );
172}; 163};
173 164
174 165
175#endif 166#endif
diff --git a/korganizer/searchdialog.cpp b/korganizer/searchdialog.cpp
index 7a945e3..de65b53 100644
--- a/korganizer/searchdialog.cpp
+++ b/korganizer/searchdialog.cpp
@@ -384,83 +384,82 @@ void SearchDialog::search(const QRegExp &re)
384 if (re.match(tod->categoriesStr()) != -1) 384 if (re.match(tod->categoriesStr()) != -1)
385#endif 385#endif
386 { 386 {
387 mMatchedTodos.append(tod); 387 mMatchedTodos.append(tod);
388 continue; 388 continue;
389 } 389 }
390 } 390 }
391 if ( mSearchAName->isChecked() || mSearchAEmail->isChecked() ) { 391 if ( mSearchAName->isChecked() || mSearchAEmail->isChecked() ) {
392 QPtrList<Attendee> tmpAList = tod->attendees(); 392 QPtrList<Attendee> tmpAList = tod->attendees();
393 Attendee *a; 393 Attendee *a;
394 for (a = tmpAList.first(); a; a = tmpAList.next()) { 394 for (a = tmpAList.first(); a; a = tmpAList.next()) {
395 if (mSearchAName->isChecked()) { 395 if (mSearchAName->isChecked()) {
396#if QT_VERSION >= 0x030000 396#if QT_VERSION >= 0x030000
397 if (re.search(a->name()) != -1) 397 if (re.search(a->name()) != -1)
398#else 398#else
399 if (re.match(a->name()) != -1) 399 if (re.match(a->name()) != -1)
400#endif 400#endif
401 { 401 {
402 mMatchedTodos.append(tod); 402 mMatchedTodos.append(tod);
403 break; 403 break;
404 } 404 }
405 } 405 }
406 if (mSearchAEmail->isChecked()) { 406 if (mSearchAEmail->isChecked()) {
407#if QT_VERSION >= 0x030000 407#if QT_VERSION >= 0x030000
408 if (re.search(a->email()) != -1) 408 if (re.search(a->email()) != -1)
409#else 409#else
410 if (re.match(a->email()) != -1) 410 if (re.match(a->email()) != -1)
411#endif 411#endif
412 { 412 {
413 mMatchedTodos.append(tod); 413 mMatchedTodos.append(tod);
414 break; 414 break;
415 } 415 }
416 } 416 }
417 } 417 }
418 } 418 }
419 } 419 }
420 } 420 }
421 mMatchedJournals.clear(); 421 mMatchedJournals.clear();
422 if (mSearchJournal->isChecked() ) { 422 if (mSearchJournal->isChecked() ) {
423 QPtrList<Journal> journals = mCalendar->journals( ); 423 QPtrList<Journal> journals = mCalendar->journals( );
424 Journal* journ; 424 Journal* journ;
425 425
426 for(journ=journals.first();journ;journ=journals.next()) { 426 for(journ=journals.first();journ;journ=journals.next()) {
427 if ( journ->dtStart().date() <= mEndDate->date() 427 if ( journ->dtStart().date() <= mEndDate->date()
428 &&journ->dtStart().date() >= mStartDate->date()) { 428 &&journ->dtStart().date() >= mStartDate->date()) {
429#if QT_VERSION >= 0x030000 429#if QT_VERSION >= 0x030000
430 if (re.search(journ->description()) != -1) 430 if (re.search(journ->description()) != -1)
431#else 431#else
432 if (re.match(journ->description()) != -1) 432 if (re.match(journ->description()) != -1)
433#endif 433#endif
434 { 434 {
435 mMatchedJournals.append(journ); 435 mMatchedJournals.append(journ);
436 continue; 436 continue;
437 } 437 }
438 } 438 }
439 } 439 }
440 } 440 }
441 441
442} 442}
443 443
444void SearchDialog::keyPressEvent ( QKeyEvent *e) 444void SearchDialog::keyPressEvent ( QKeyEvent *e)
445{ 445{
446 switch ( e->key() ) { 446 switch ( e->key() ) {
447 case Qt::Key_Escape: 447 case Qt::Key_Escape:
448 hide(); 448 close();
449 break; 449 break;
450 case Qt::Key_F: 450 case Qt::Key_F:
451 if ( e->state() == Qt::ControlButton ) { 451 if ( e->state() == Qt::ControlButton ) {
452 qDebug("full ");
453 452
454 } 453 }
455 break; 454 break;
456 case Qt::Key_Return: 455 case Qt::Key_Return:
457 case Qt::Key_Enter: 456 case Qt::Key_Enter:
458 doSearch(); 457 doSearch();
459 break; 458 break;
460 459
461 default: 460 default:
462 e->ignore(); 461 e->ignore();
463 } 462 }
464} 463}
465 464
466//mMatchedJournals; 465//mMatchedJournals;