summaryrefslogtreecommitdiffabout
path: root/korganizer
authorzautrix <zautrix>2004-10-21 22:20:39 (UTC)
committer zautrix <zautrix>2004-10-21 22:20:39 (UTC)
commitd6f9bd535e8cabe653bdff329500f9153e5e11fb (patch) (unidiff)
tree6f83c692713c41896a165e399f259a744f125e5c /korganizer
parentbb235c5a639b914574e1e247d2de6e479517585f (diff)
downloadkdepimpi-d6f9bd535e8cabe653bdff329500f9153e5e11fb.zip
kdepimpi-d6f9bd535e8cabe653bdff329500f9153e5e11fb.tar.gz
kdepimpi-d6f9bd535e8cabe653bdff329500f9153e5e11fb.tar.bz2
small fixes
Diffstat (limited to 'korganizer') (more/less context) (ignore whitespace changes)
-rw-r--r--korganizer/koeventviewer.cpp5
-rw-r--r--korganizer/kolistview.cpp13
-rw-r--r--korganizer/main.cpp2
3 files changed, 17 insertions, 3 deletions
diff --git a/korganizer/koeventviewer.cpp b/korganizer/koeventviewer.cpp
index e938e4e..1fcc977 100644
--- a/korganizer/koeventviewer.cpp
+++ b/korganizer/koeventviewer.cpp
@@ -474,60 +474,61 @@ void KOEventViewer::formatAttendees(Incidence *event)
474 else mText += a->email(); 474 else mText += a->email();
475 mText += "</a>\n"; 475 mText += "</a>\n";
476#endif 476#endif
477 477
478 478
479 if (!a->email().isEmpty()) { 479 if (!a->email().isEmpty()) {
480 if (iconPath) { 480 if (iconPath) {
481 mText += "<a href=\"mailto:" + a->name() +" <" + a->email() + ">:" + mMailSubject + "\">"; 481 mText += "<a href=\"mailto:" + a->name() +" <" + a->email() + ">:" + mMailSubject + "\">";
482 mText += "<IMG src=\"" + iconPath + "\">"; 482 mText += "<IMG src=\"" + iconPath + "\">";
483 mText += "</a>\n"; 483 mText += "</a>\n";
484 } 484 }
485 } 485 }
486 if (a->status() != Attendee::NeedsAction ) 486 if (a->status() != Attendee::NeedsAction )
487 mText +="[" + a->statusStr() + "] "; 487 mText +="[" + a->statusStr() + "] ";
488 if (a->role() == Attendee::Chair ) 488 if (a->role() == Attendee::Chair )
489 mText +="(" + a->roleStr().left(1) + ".)"; 489 mText +="(" + a->roleStr().left(1) + ".)";
490 } 490 }
491 mText.append("</li></ul>"); 491 mText.append("</li></ul>");
492 } 492 }
493 493
494} 494}
495void KOEventViewer::appendJournal(Journal *jour, int mode ) 495void KOEventViewer::appendJournal(Journal *jour, int mode )
496{ 496{
497 bool shortDate = KOPrefs::instance()->mShortDateInViewer; 497 bool shortDate = KOPrefs::instance()->mShortDateInViewer;
498 if (mode == 0 ) 498 if (mode == 0 ) {
499 addTag("h2",i18n("Journal from: ")); 499 addTag("h2",i18n("Journal from: "));
500 }
500 else { 501 else {
501 if ( mode == 1 ) { 502 if ( mode == 1 ) {
502 addTag("h2",i18n( "Local: " ) +i18n("Journal from: ")); 503 addTag("h2",i18n( "Local: " ) +i18n("Journal from: "));
503 } else { 504 } else {
504 addTag("h2",i18n( "Remote: " ) +i18n("Journal from: ")); 505 addTag("h2",i18n( "Remote: " ) +i18n("Journal from: "));
505 } 506 }
506 addTag("h3",i18n( "Last modified " ) + KGlobal::locale()->formatDateTime(jour->lastModified(),shortDate ) );
507 } 507 }
508 topLevelWidget()->setCaption("Journal Viewer"); 508 topLevelWidget()->setCaption("Journal Viewer");
509 mText.append(i18n("<h3> %1 </h3> ").arg(jour->dtStartDateStr(KOPrefs::instance()->mShortDateInViewer))); 509 mText.append(i18n("<h3> %1 </h3> ").arg(jour->dtStartDateStr(KOPrefs::instance()->mShortDateInViewer)));
510 addTag("b",i18n( "Last modified: " ) + KGlobal::locale()->formatDateTime(jour->lastModified(),shortDate ) );
510 if (!jour->description().isEmpty()) { 511 if (!jour->description().isEmpty()) {
511 addTag("p",jour->description()); 512 addTag("p",jour->description());
512 } 513 }
513 setText(mText); 514 setText(mText);
514} 515}
515 516
516void KOEventViewer::formatReadOnly(Incidence *event) 517void KOEventViewer::formatReadOnly(Incidence *event)
517{ 518{
518 if (event->isReadOnly()) { 519 if (event->isReadOnly()) {
519 addTag("p","<em>(" + i18n("read-only") + ")</em>"); 520 addTag("p","<em>(" + i18n("read-only") + ")</em>");
520 } 521 }
521} 522}
522void KOEventViewer::setSyncMode( bool b ) 523void KOEventViewer::setSyncMode( bool b )
523{ 524{
524 mSyncMode = b; 525 mSyncMode = b;
525} 526}
526 527
527 528
528void KOEventViewer::setTodo(Todo *event, bool clearV ) 529void KOEventViewer::setTodo(Todo *event, bool clearV )
529{ 530{
530 if ( clearV ) 531 if ( clearV )
531 clearEvents(); 532 clearEvents();
532 if ( mSyncMode ) { 533 if ( mSyncMode ) {
533 if ( clearV ) 534 if ( clearV )
diff --git a/korganizer/kolistview.cpp b/korganizer/kolistview.cpp
index 9a3ba73..bafd349 100644
--- a/korganizer/kolistview.cpp
+++ b/korganizer/kolistview.cpp
@@ -11,48 +11,49 @@
11 This program is distributed in the hope that it will be useful, 11 This program is distributed in the hope that it will be useful,
12 but WITHOUT ANY WARRANTY; without even the implied warranty of 12 but WITHOUT ANY WARRANTY; without even the implied warranty of
13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 GNU General Public License for more details. 14 GNU General Public License for more details.
15 15
16 You should have received a copy of the GNU General Public License 16 You should have received a copy of the GNU General Public License
17 along with this program; if not, write to the Free Software 17 along with this program; if not, write to the Free Software
18 Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. 18 Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
19 19
20 As a special exception, permission is given to link this program 20 As a special exception, permission is given to link this program
21 with any edition of Qt, and distribute the resulting executable, 21 with any edition of Qt, and distribute the resulting executable,
22 without including the source code for Qt in the source distribution. 22 without including the source code for Qt in the source distribution.
23*/ 23*/
24 24
25#include <qlistview.h> 25#include <qlistview.h>
26#include <qlayout.h> 26#include <qlayout.h>
27#include <qlabel.h> 27#include <qlabel.h>
28#include <qpopupmenu.h> 28#include <qpopupmenu.h>
29#include <qprogressbar.h> 29#include <qprogressbar.h>
30#include <qfileinfo.h> 30#include <qfileinfo.h>
31#include <qmessagebox.h> 31#include <qmessagebox.h>
32#include <qdialog.h> 32#include <qdialog.h>
33#include <qtextstream.h> 33#include <qtextstream.h>
34#include <qdir.h> 34#include <qdir.h>
35#include <qregexp.h>
35 36
36#include <klocale.h> 37#include <klocale.h>
37#include <kdebug.h> 38#include <kdebug.h>
38#include <kiconloader.h> 39#include <kiconloader.h>
39#include <kglobal.h> 40#include <kglobal.h>
40 41
41#include <libkcal/calendar.h> 42#include <libkcal/calendar.h>
42#include <libkcal/calendarlocal.h> 43#include <libkcal/calendarlocal.h>
43#include <libkcal/icalformat.h> 44#include <libkcal/icalformat.h>
44#include <libkcal/vcalformat.h> 45#include <libkcal/vcalformat.h>
45#include <libkcal/recurrence.h> 46#include <libkcal/recurrence.h>
46#include <libkcal/filestorage.h> 47#include <libkcal/filestorage.h>
47#include <libkdepim/categoryselectdialog.h> 48#include <libkdepim/categoryselectdialog.h>
48#ifndef DESKTOP_VERSION 49#ifndef DESKTOP_VERSION
49#include <qpe/qpeapplication.h> 50#include <qpe/qpeapplication.h>
50#else 51#else
51#include <qapplication.h> 52#include <qapplication.h>
52#endif 53#endif
53 54
54#ifndef KORG_NOPRINTER 55#ifndef KORG_NOPRINTER
55#include "calprinter.h" 56#include "calprinter.h"
56#endif 57#endif
57#include "koglobals.h" 58#include "koglobals.h"
58#include "koprefs.h" 59#include "koprefs.h"
@@ -144,58 +145,63 @@ bool ListItemVisitor::visit(Todo *t)
144 mItem->setText(8,"---"); 145 mItem->setText(8,"---");
145 } 146 }
146 mItem->setText(9, t->cancelled() ? i18n("Yes") : i18n("No")); 147 mItem->setText(9, t->cancelled() ? i18n("Yes") : i18n("No"));
147 mItem->setText(10,t->categoriesStr()); 148 mItem->setText(10,t->categoriesStr());
148 149
149 QString key; 150 QString key;
150 QDate d; 151 QDate d;
151 if (t->hasDueDate()) { 152 if (t->hasDueDate()) {
152 d = t->dtDue().date(); 153 d = t->dtDue().date();
153 QTime tm = t->doesFloat() ? QTime(0,0) : t->dtDue().time(); 154 QTime tm = t->doesFloat() ? QTime(0,0) : t->dtDue().time();
154 key.sprintf("%04d%02d%02d%02d%02d",d.year(),d.month(),d.day(),tm.hour(),tm.minute()); 155 key.sprintf("%04d%02d%02d%02d%02d",d.year(),d.month(),d.day(),tm.hour(),tm.minute());
155 mItem->setSortKey(7,key); 156 mItem->setSortKey(7,key);
156 } 157 }
157 if ( t->hasStartDate() ) { 158 if ( t->hasStartDate() ) {
158 d = t->dtStart().date(); 159 d = t->dtStart().date();
159 QTime tm = t->doesFloat() ? QTime(0,0) : t->dtStart().time(); 160 QTime tm = t->doesFloat() ? QTime(0,0) : t->dtStart().time();
160 key.sprintf("%04d%02d%02d%02d%02d",d.year(),d.month(),d.day(),tm.hour(),tm.minute()); 161 key.sprintf("%04d%02d%02d%02d%02d",d.year(),d.month(),d.day(),tm.hour(),tm.minute());
161 mItem->setSortKey(1,key); 162 mItem->setSortKey(1,key);
162 } 163 }
163 return true; 164 return true;
164} 165}
165 166
166bool ListItemVisitor::visit(Journal * j) 167bool ListItemVisitor::visit(Journal * j)
167{ 168{
168 mItem->setText(0,i18n("Journal")); 169 QString des = j->description().left(50);
170 des = des.simplifyWhiteSpace ();
171 des.replace (QRegExp ("\\n"),"" );
172 des.replace (QRegExp ("\\r"),"" );
173 mItem->setText(0,i18n("Journal")+": "+des.left(25));
169 mItem->setText(1,j->dtStartDateStr()); 174 mItem->setText(1,j->dtStartDateStr());
170 mItem->setText(2,"---"); 175 mItem->setText(2,"---");
171 mItem->setText(3,"---"); 176 mItem->setText(3,"---");
172 mItem->setText(4,"---"); 177 mItem->setText(4,"---");
173 mItem->setText(5,"---"); 178 mItem->setText(5,"---");
174 mItem->setText(6,"---"); 179 mItem->setText(6,"---");
175 mItem->setText(7,j->dtStartDateStr()); 180 mItem->setText(7,j->dtStartDateStr());
176 mItem->setText(8,"---"); 181 mItem->setText(8,"---");
177 mItem->setText(9,"---"); 182 mItem->setText(9,"---");
183 mItem->setText(10,i18n("Last Modified: ")+ KGlobal::locale()->formatDateTime( j->lastModified() , true) );
178 184
179 QString key; 185 QString key;
180 QDate d = j->dtStart().date(); 186 QDate d = j->dtStart().date();
181 key.sprintf("%04d%02d%02d",d.year(),d.month(),d.day()); 187 key.sprintf("%04d%02d%02d",d.year(),d.month(),d.day());
182 mItem->setSortKey(1,key); 188 mItem->setSortKey(1,key);
183 mItem->setSortKey(7,key); 189 mItem->setSortKey(7,key);
184 190
185 return true; 191 return true;
186} 192}
187 193
188KOListView::KOListView(Calendar *calendar, QWidget *parent, 194KOListView::KOListView(Calendar *calendar, QWidget *parent,
189 const char *name) 195 const char *name)
190 : KOEventView(calendar, parent, name) 196 : KOEventView(calendar, parent, name)
191{ 197{
192 mActiveItem = 0; 198 mActiveItem = 0;
193 mListView = new KOListViewListView(this); 199 mListView = new KOListViewListView(this);
194 mListView->addColumn(i18n("Summary")); 200 mListView->addColumn(i18n("Summary"));
195 mListView->addColumn(i18n("Start Date")); 201 mListView->addColumn(i18n("Start Date"));
196 mListView->addColumn(i18n("Start Time")); 202 mListView->addColumn(i18n("Start Time"));
197 mListView->addColumn(i18n("End Date")); 203 mListView->addColumn(i18n("End Date"));
198 mListView->addColumn(i18n("End Time")); 204 mListView->addColumn(i18n("End Time"));
199 mListView->addColumn(i18n("Alarm")); // alarm set? 205 mListView->addColumn(i18n("Alarm")); // alarm set?
200 mListView->addColumn(i18n("Recurs")); // recurs? 206 mListView->addColumn(i18n("Recurs")); // recurs?
201 mListView->addColumn(i18n("Due Date")); 207 mListView->addColumn(i18n("Due Date"));
@@ -668,53 +674,58 @@ void KOListView::hideDates()
668 674
669void KOListView::updateView() 675void KOListView::updateView()
670{ 676{
671 mListView->setFocus(); 677 mListView->setFocus();
672 if ( mListView->firstChild () ) 678 if ( mListView->firstChild () )
673 mListView->setCurrentItem( mListView->firstChild () ); 679 mListView->setCurrentItem( mListView->firstChild () );
674} 680}
675void KOListView::updateConfig() 681void KOListView::updateConfig()
676{ 682{
677 683
678 mListView->setFont ( KOPrefs::instance()->mListViewFont ); 684 mListView->setFont ( KOPrefs::instance()->mListViewFont );
679 updateView(); 685 updateView();
680 686
681} 687}
682void KOListView::setStartDate(const QDate &start) 688void KOListView::setStartDate(const QDate &start)
683{ 689{
684 mStartDate = start; 690 mStartDate = start;
685} 691}
686 692
687void KOListView::showDates(const QDate &start, const QDate &end) 693void KOListView::showDates(const QDate &start, const QDate &end)
688{ 694{
689 clear(); 695 clear();
690 mStartDate = start; 696 mStartDate = start;
691 QDate date = start; 697 QDate date = start;
698 QPtrList<Journal> j_list;
692 while( date <= end ) { 699 while( date <= end ) {
693 addEvents(calendar()->events(date)); 700 addEvents(calendar()->events(date));
694 addTodos(calendar()->todos(date)); 701 addTodos(calendar()->todos(date));
702 Journal* jo = calendar()->journal(date);
703 if ( jo )
704 j_list.append( jo );
695 date = date.addDays( 1 ); 705 date = date.addDays( 1 );
696 } 706 }
707 addJournals(j_list);
697 emit incidenceSelected( 0 ); 708 emit incidenceSelected( 0 );
698 updateView(); 709 updateView();
699 710
700} 711}
701 712
702void KOListView::addEvents(QPtrList<Event> eventList) 713void KOListView::addEvents(QPtrList<Event> eventList)
703{ 714{
704 Event *ev; 715 Event *ev;
705 for(ev = eventList.first(); ev; ev = eventList.next()) { 716 for(ev = eventList.first(); ev; ev = eventList.next()) {
706 addIncidence(ev); 717 addIncidence(ev);
707 } 718 }
708 if ( !mListView->currentItem() ){ 719 if ( !mListView->currentItem() ){
709 updateView(); 720 updateView();
710 } 721 }
711} 722}
712 723
713void KOListView::addTodos(QPtrList<Todo> eventList) 724void KOListView::addTodos(QPtrList<Todo> eventList)
714{ 725{
715 Todo *ev; 726 Todo *ev;
716 for(ev = eventList.first(); ev; ev = eventList.next()) { 727 for(ev = eventList.first(); ev; ev = eventList.next()) {
717 addIncidence(ev); 728 addIncidence(ev);
718 } 729 }
719 if ( !mListView->currentItem() ){ 730 if ( !mListView->currentItem() ){
720 updateView(); 731 updateView();
diff --git a/korganizer/main.cpp b/korganizer/main.cpp
index c8a55d2..ca53828 100644
--- a/korganizer/main.cpp
+++ b/korganizer/main.cpp
@@ -1,38 +1,39 @@
1 1
2 2
3#ifndef DESKTOP_VERSION 3#ifndef DESKTOP_VERSION
4#include <qpe/qpeapplication.h> 4#include <qpe/qpeapplication.h>
5#include <qcopchannel_qws.h> 5#include <qcopchannel_qws.h>
6#include <qpe/global.h> 6#include <qpe/global.h>
7#include <stdlib.h> 7#include <stdlib.h>
8#else 8#else
9#include <qapplication.h> 9#include <qapplication.h>
10#include <qstring.h> 10#include <qstring.h>
11#include <qwindowsstyle.h> 11#include <qwindowsstyle.h>
12#include <qplatinumstyle.h> 12#include <qplatinumstyle.h>
13#include <qsgistyle.h> 13#include <qsgistyle.h>
14#endif 14#endif
15#include <qtextcodec.h>
15 16
16#include <qdir.h> 17#include <qdir.h>
17#include <kstandarddirs.h> 18#include <kstandarddirs.h>
18#include <kglobal.h> 19#include <kglobal.h>
19#include <stdio.h> 20#include <stdio.h>
20#include "mainwindow.h" 21#include "mainwindow.h"
21 22
22int main( int argc, char **argv ) 23int main( int argc, char **argv )
23{ 24{
24#ifndef DESKTOP_VERSION 25#ifndef DESKTOP_VERSION
25 QPEApplication a( argc, argv ); 26 QPEApplication a( argc, argv );
26 a.setKeepRunning (); 27 a.setKeepRunning ();
27#else 28#else
28 QApplication a( argc, argv ); 29 QApplication a( argc, argv );
29 QApplication::setStyle( new QPlatinumStyle ()); 30 QApplication::setStyle( new QPlatinumStyle ());
30 QString hdir = QDir::homeDirPath(); 31 QString hdir = QDir::homeDirPath();
31 // there is a bug when creating dirs for WIN 98 32 // there is a bug when creating dirs for WIN 98
32 // it is difficult to fix, because we have no WIN 98 runnung 33 // it is difficult to fix, because we have no WIN 98 runnung
33 // such that we try it to create the dirs at startup here 34 // such that we try it to create the dirs at startup here
34 if ( hdir == "C:\\" ) { // win 98 or ME 35 if ( hdir == "C:\\" ) { // win 98 or ME
35 QDir app_dir; 36 QDir app_dir;
36 if ( !app_dir.exists("C:\\kdepim") ) 37 if ( !app_dir.exists("C:\\kdepim") )
37 app_dir.mkdir ("C:\\kdepim"); 38 app_dir.mkdir ("C:\\kdepim");
38 if ( !app_dir.exists("C:\\kdepim\\apps") ) 39 if ( !app_dir.exists("C:\\kdepim\\apps") )
@@ -76,29 +77,30 @@ int main( int argc, char **argv )
76#else 77#else
77 fileName = qApp->applicationDirPath () + "/kdepim/korganizer/"; 78 fileName = qApp->applicationDirPath () + "/kdepim/korganizer/";
78 KGlobal::iconLoader()->setIconPath(QDir::convertSeparators(fileName)); 79 KGlobal::iconLoader()->setIconPath(QDir::convertSeparators(fileName));
79#endif 80#endif
80 KStandardDirs::setAppDir( QDir::convertSeparators(locateLocal("data", "korganizer"))); 81 KStandardDirs::setAppDir( QDir::convertSeparators(locateLocal("data", "korganizer")));
81 MainWindow m; 82 MainWindow m;
82#ifndef DESKTOP_VERSION 83#ifndef DESKTOP_VERSION
83 84
84 QObject::connect( &a, SIGNAL (appMessage ( const QCString &, const QByteArray & )),&m, SLOT(recieve( const QCString&, const QByteArray& ))); 85 QObject::connect( &a, SIGNAL (appMessage ( const QCString &, const QByteArray & )),&m, SLOT(recieve( const QCString&, const QByteArray& )));
85 a.showMainWidget(&m ); 86 a.showMainWidget(&m );
86#else 87#else
87 a.setMainWidget(&m ); 88 a.setMainWidget(&m );
88 m.show(); 89 m.show();
89 //m.resize( 800, 600 ); 90 //m.resize( 800, 600 );
90 QObject::connect(&a, SIGNAL(lastWindowClosed()), &a, SLOT(quit())); 91 QObject::connect(&a, SIGNAL(lastWindowClosed()), &a, SLOT(quit()));
91#endif 92#endif
92 if ( argc > 1 ) { 93 if ( argc > 1 ) {
93 QCString command = argv[1]; 94 QCString command = argv[1];
94 if ( argc > 2 ) 95 if ( argc > 2 )
95 command += argv[2]; 96 command += argv[2];
96 qApp->processEvents(); 97 qApp->processEvents();
97 m.recieve(command, QByteArray() ); 98 m.recieve(command, QByteArray() );
98 99
99 } 100 }
101
100 a.exec(); 102 a.exec();
101 103
102 } 104 }
103 qDebug("KO: Bye! "); 105 qDebug("KO: Bye! ");
104} 106}