summaryrefslogtreecommitdiffabout
path: root/korganizer
authorzautrix <zautrix>2005-03-28 19:45:15 (UTC)
committer zautrix <zautrix>2005-03-28 19:45:15 (UTC)
commit4034290f894ff7d1b0cf1197078e0ed832566bb7 (patch) (unidiff)
tree21b7d2e2568f11079f705b8312e15146be4309ac /korganizer
parentea070abfcff313cac87dbb4d5c9410784740de21 (diff)
downloadkdepimpi-4034290f894ff7d1b0cf1197078e0ed832566bb7.zip
kdepimpi-4034290f894ff7d1b0cf1197078e0ed832566bb7.tar.gz
kdepimpi-4034290f894ff7d1b0cf1197078e0ed832566bb7.tar.bz2
print fixes
Diffstat (limited to 'korganizer') (more/less context) (ignore whitespace changes)
-rw-r--r--korganizer/koagendaview.cpp5
-rw-r--r--korganizer/koeventviewer.h8
2 files changed, 9 insertions, 4 deletions
diff --git a/korganizer/koagendaview.cpp b/korganizer/koagendaview.cpp
index f452db0..b9909d6 100644
--- a/korganizer/koagendaview.cpp
+++ b/korganizer/koagendaview.cpp
@@ -1009,128 +1009,132 @@ void KOAgendaView::updateEventDates(KOAgendaItem *item, int type)
1009 1009
1010 to->setDtDue(endDt); 1010 to->setDtDue(endDt);
1011 if ( to->hasStartDate() ) { 1011 if ( to->hasStartDate() ) {
1012 if (to->dtStart() >= to->dtDue() ) 1012 if (to->dtStart() >= to->dtDue() )
1013 to->setDtStart(to->dtDue().addDays( -2 )); 1013 to->setDtStart(to->dtDue().addDays( -2 ));
1014 } 1014 }
1015 1015
1016 } 1016 }
1017 //qDebug("KOAgendaView::updateEventDates stsart %s end %s ", startDt.toString().latin1(), endDt.toString().latin1() ); 1017 //qDebug("KOAgendaView::updateEventDates stsart %s end %s ", startDt.toString().latin1(), endDt.toString().latin1() );
1018 item->incidence()->setRevision(item->incidence()->revision()+1); 1018 item->incidence()->setRevision(item->incidence()->revision()+1);
1019 item->setItemDate(startDt.date()); 1019 item->setItemDate(startDt.date());
1020 //item->updateItem(); 1020 //item->updateItem();
1021 if ( item->incidence()->type() == "Todo" ) { 1021 if ( item->incidence()->type() == "Todo" ) {
1022 emit todoMoved((Todo*)item->incidence(), KOGlobals::EVENTEDITED ); 1022 emit todoMoved((Todo*)item->incidence(), KOGlobals::EVENTEDITED );
1023 1023
1024 } 1024 }
1025 else 1025 else
1026 emit incidenceChanged(item->incidence(), KOGlobals::EVENTEDITED); 1026 emit incidenceChanged(item->incidence(), KOGlobals::EVENTEDITED);
1027 item->updateItem(); 1027 item->updateItem();
1028} 1028}
1029 1029
1030void KOAgendaView::showDates( const QDate &start, const QDate &end ) 1030void KOAgendaView::showDates( const QDate &start, const QDate &end )
1031{ 1031{
1032 // kdDebug() << "KOAgendaView::selectDates" << endl; 1032 // kdDebug() << "KOAgendaView::selectDates" << endl;
1033 1033
1034 mSelectedDates.clear(); 1034 mSelectedDates.clear();
1035 // qDebug("KOAgendaView::showDates "); 1035 // qDebug("KOAgendaView::showDates ");
1036 QDate d = start; 1036 QDate d = start;
1037 while (d <= end) { 1037 while (d <= end) {
1038 mSelectedDates.append(d); 1038 mSelectedDates.append(d);
1039 d = d.addDays( 1 ); 1039 d = d.addDays( 1 );
1040 } 1040 }
1041 1041
1042 // and update the view 1042 // and update the view
1043 fillAgenda(); 1043 fillAgenda();
1044} 1044}
1045 1045
1046 1046
1047void KOAgendaView::showEvents(QPtrList<Event>) 1047void KOAgendaView::showEvents(QPtrList<Event>)
1048{ 1048{
1049 kdDebug() << "KOAgendaView::showEvents() is not yet implemented" << endl; 1049 kdDebug() << "KOAgendaView::showEvents() is not yet implemented" << endl;
1050} 1050}
1051 1051
1052void KOAgendaView::changeEventDisplay(Event *, int) 1052void KOAgendaView::changeEventDisplay(Event *, int)
1053{ 1053{
1054 // qDebug("KOAgendaView::changeEventDisplay "); 1054 // qDebug("KOAgendaView::changeEventDisplay ");
1055 // kdDebug() << "KOAgendaView::changeEventDisplay" << endl; 1055 // kdDebug() << "KOAgendaView::changeEventDisplay" << endl;
1056 // this should be re-written to be MUCH smarter. Right now we 1056 // this should be re-written to be MUCH smarter. Right now we
1057 // are just playing dumb. 1057 // are just playing dumb.
1058 fillAgenda(); 1058 fillAgenda();
1059} 1059}
1060 1060
1061void KOAgendaView::fillAgenda(const QDate &) 1061void KOAgendaView::fillAgenda(const QDate &)
1062{ 1062{
1063 // qDebug("KOAgendaView::fillAgenda "); 1063 // qDebug("KOAgendaView::fillAgenda ");
1064 fillAgenda(); 1064 fillAgenda();
1065} 1065}
1066 1066
1067void KOAgendaView::fillAgenda() 1067void KOAgendaView::fillAgenda()
1068{ 1068{
1069 if ( globalFlagBlockStartup ) 1069 if ( globalFlagBlockStartup )
1070 return; 1070 return;
1071 if ( globalFlagBlockAgenda == 1 ) 1071 if ( globalFlagBlockAgenda == 1 )
1072 return; 1072 return;
1073 static bool onlyOne = false;
1074 if ( onlyOne )
1075 return;
1076 onlyOne = true;
1073 //if ( globalFlagBlockAgenda == 2 ) 1077 //if ( globalFlagBlockAgenda == 2 )
1074 //globalFlagBlockAgenda = 0; 1078 //globalFlagBlockAgenda = 0;
1075 // globalFlagBlockPainting = false; 1079 // globalFlagBlockPainting = false;
1076 if ( globalFlagBlockAgenda == 0 ) 1080 if ( globalFlagBlockAgenda == 0 )
1077 globalFlagBlockAgenda = 1; 1081 globalFlagBlockAgenda = 1;
1078 // clearView(); 1082 // clearView();
1079 //qDebug("fillAgenda()++++ "); 1083 //qDebug("fillAgenda()++++ ");
1080 globalFlagBlockAgendaItemPaint = 1; 1084 globalFlagBlockAgendaItemPaint = 1;
1081 1085
1082 mAllDayAgenda->changeColumns(mSelectedDates.count()); 1086 mAllDayAgenda->changeColumns(mSelectedDates.count());
1083 mAgenda->changeColumns(mSelectedDates.count()); 1087 mAgenda->changeColumns(mSelectedDates.count());
1084 qApp->processEvents(); 1088 qApp->processEvents();
1085 mEventIndicatorTop->changeColumns(mSelectedDates.count()); 1089 mEventIndicatorTop->changeColumns(mSelectedDates.count());
1086 mEventIndicatorBottom->changeColumns(mSelectedDates.count()); 1090 mEventIndicatorBottom->changeColumns(mSelectedDates.count());
1087 setHolidayMasks(); 1091 setHolidayMasks();
1088 1092
1089 //mAgenda->hideUnused(); 1093 //mAgenda->hideUnused();
1090 //mAllDayAgenda->hideUnused(); 1094 //mAllDayAgenda->hideUnused();
1091 1095
1092 // mAgenda->blockNextRepaint( false ); 1096 // mAgenda->blockNextRepaint( false );
1093 // mAgenda->viewport()->repaint(); 1097 // mAgenda->viewport()->repaint();
1094 // mAgenda->blockNextRepaint( true ); 1098 // mAgenda->blockNextRepaint( true );
1095 mMinY.resize(mSelectedDates.count()); 1099 mMinY.resize(mSelectedDates.count());
1096 mMaxY.resize(mSelectedDates.count()); 1100 mMaxY.resize(mSelectedDates.count());
1097 1101
1098 QPtrList<Event> dayEvents; 1102 QPtrList<Event> dayEvents;
1099 1103
1100 // ToDo items shall be displayed for the day they are due, but only showed today if they are already overdue. 1104 // ToDo items shall be displayed for the day they are due, but only showed today if they are already overdue.
1101 // Therefore, gtodoset all of them. 1105 // Therefore, gtodoset all of them.
1102 QPtrList<Todo> todos = calendar()->todos(); 1106 QPtrList<Todo> todos = calendar()->todos();
1103 1107
1104 mAgenda->setDateList(mSelectedDates); 1108 mAgenda->setDateList(mSelectedDates);
1105 1109
1106 QDate today = QDate::currentDate(); 1110 QDate today = QDate::currentDate();
1107 1111
1108 DateList::ConstIterator dit; 1112 DateList::ConstIterator dit;
1109 int curCol = 0; 1113 int curCol = 0;
1110 for( dit = mSelectedDates.begin(); dit != mSelectedDates.end(); ++dit ) { 1114 for( dit = mSelectedDates.begin(); dit != mSelectedDates.end(); ++dit ) {
1111 QDate currentDate = *dit; 1115 QDate currentDate = *dit;
1112 // kdDebug() << "KOAgendaView::fillAgenda(): " << currentDate.toString() 1116 // kdDebug() << "KOAgendaView::fillAgenda(): " << currentDate.toString()
1113 // << endl; 1117 // << endl;
1114 1118
1115 dayEvents = calendar()->events(currentDate,true); 1119 dayEvents = calendar()->events(currentDate,true);
1116 1120
1117 // Default values, which can never be reached 1121 // Default values, which can never be reached
1118 mMinY[curCol] = mAgenda->timeToY(QTime(23,59)) + 1; 1122 mMinY[curCol] = mAgenda->timeToY(QTime(23,59)) + 1;
1119 mMaxY[curCol] = mAgenda->timeToY(QTime(0,0)) - 1; 1123 mMaxY[curCol] = mAgenda->timeToY(QTime(0,0)) - 1;
1120 1124
1121 unsigned int numEvent; 1125 unsigned int numEvent;
1122 for(numEvent=0;numEvent<dayEvents.count();++numEvent) { 1126 for(numEvent=0;numEvent<dayEvents.count();++numEvent) {
1123 Event *event = dayEvents.at(numEvent); 1127 Event *event = dayEvents.at(numEvent);
1124 if ( !KOPrefs::instance()->mShowSyncEvents && event->uid().left(2) == QString("la") ) 1128 if ( !KOPrefs::instance()->mShowSyncEvents && event->uid().left(2) == QString("la") )
1125 if ( event->uid().left(15) == QString("last-syncEvent-") ) 1129 if ( event->uid().left(15) == QString("last-syncEvent-") )
1126 continue; 1130 continue;
1127 // kdDebug() << " Event: " << event->summary() << endl; 1131 // kdDebug() << " Event: " << event->summary() << endl;
1128 1132
1129 int beginX = currentDate.daysTo(event->dtStart().date()) + curCol; 1133 int beginX = currentDate.daysTo(event->dtStart().date()) + curCol;
1130 int endX = currentDate.daysTo(event->dtEnd().date()) + curCol; 1134 int endX = currentDate.daysTo(event->dtEnd().date()) + curCol;
1131 1135
1132 // kdDebug() << " beginX: " << beginX << " endX: " << endX << endl; 1136 // kdDebug() << " beginX: " << beginX << " endX: " << endX << endl;
1133 1137
1134 if (event->doesFloat()) { 1138 if (event->doesFloat()) {
1135 if (event->recurrence()->doesRecur()) { 1139 if (event->recurrence()->doesRecur()) {
1136 mAllDayAgenda->insertAllDayItem(event,currentDate,curCol,curCol); 1140 mAllDayAgenda->insertAllDayItem(event,currentDate,curCol,curCol);
@@ -1196,128 +1200,129 @@ void KOAgendaView::fillAgenda()
1196 1200
1197 // ToDo items shall be displayed for the day they are due, but only showed today if they are already overdue. 1201 // ToDo items shall be displayed for the day they are due, but only showed today if they are already overdue.
1198 // Already completed items can be displayed on their original due date 1202 // Already completed items can be displayed on their original due date
1199 //if not KOPrefs::instance()->mShowTodoInAgenda, show overdue in agenda 1203 //if not KOPrefs::instance()->mShowTodoInAgenda, show overdue in agenda
1200 bool overdue = (!todo->isCompleted()) && (todo->dtDue() < today) && KOPrefs::instance()->mShowTodoInAgenda; 1204 bool overdue = (!todo->isCompleted()) && (todo->dtDue() < today) && KOPrefs::instance()->mShowTodoInAgenda;
1201 bool fillIn = false; 1205 bool fillIn = false;
1202 if ( todo->hasCompletedDate() && todo->completed().date() == currentDate ) 1206 if ( todo->hasCompletedDate() && todo->completed().date() == currentDate )
1203 fillIn = true; 1207 fillIn = true;
1204 if ( ! fillIn && !todo->hasCompletedDate() ) 1208 if ( ! fillIn && !todo->hasCompletedDate() )
1205 fillIn = ((todo->dtDue().date() == currentDate) && !overdue) || ((currentDate == today) && overdue); 1209 fillIn = ((todo->dtDue().date() == currentDate) && !overdue) || ((currentDate == today) && overdue);
1206 if ( fillIn ) { 1210 if ( fillIn ) {
1207 if ( (todo->doesFloat() || overdue ) && !todo->hasCompletedDate() ) { // Todo has no due-time set or is already overdue 1211 if ( (todo->doesFloat() || overdue ) && !todo->hasCompletedDate() ) { // Todo has no due-time set or is already overdue
1208 if ( KOPrefs::instance()->mShowTodoInAgenda ) 1212 if ( KOPrefs::instance()->mShowTodoInAgenda )
1209 mAllDayAgenda->insertAllDayItem(todo, currentDate, curCol, curCol); 1213 mAllDayAgenda->insertAllDayItem(todo, currentDate, curCol, curCol);
1210 } 1214 }
1211 else { 1215 else {
1212 QDateTime dt; 1216 QDateTime dt;
1213 if ( todo->hasCompletedDate() ) 1217 if ( todo->hasCompletedDate() )
1214 dt = todo->completed(); 1218 dt = todo->completed();
1215 else 1219 else
1216 dt = todo->dtDue();; 1220 dt = todo->dtDue();;
1217 1221
1218 1222
1219 int endY = mAgenda->timeToY(dt.time()) - 1; 1223 int endY = mAgenda->timeToY(dt.time()) - 1;
1220 int hi = (18/KOPrefs::instance()->mHourSize); 1224 int hi = (18/KOPrefs::instance()->mHourSize);
1221 //qDebug("hei %d ",KOPrefs::instance()->mHourSize); 1225 //qDebug("hei %d ",KOPrefs::instance()->mHourSize);
1222 int startY = endY -hi; 1226 int startY = endY -hi;
1223 1227
1224 mAgenda->insertItem(todo,currentDate,curCol,startY,endY); 1228 mAgenda->insertItem(todo,currentDate,curCol,startY,endY);
1225 1229
1226 if (startY < mMinY[curCol]) mMinY[curCol] = startY; 1230 if (startY < mMinY[curCol]) mMinY[curCol] = startY;
1227 if (endY > mMaxY[curCol]) mMaxY[curCol] = endY; 1231 if (endY > mMaxY[curCol]) mMaxY[curCol] = endY;
1228 } 1232 }
1229 } 1233 }
1230 } 1234 }
1231 // ---------- display Todos] -------------- 1235 // ---------- display Todos] --------------
1232 1236
1233 ++curCol; 1237 ++curCol;
1234 } 1238 }
1235 mAgenda->hideUnused(); 1239 mAgenda->hideUnused();
1236 mAllDayAgenda->hideUnused(); 1240 mAllDayAgenda->hideUnused();
1237 mAgenda->checkScrollBoundaries(); 1241 mAgenda->checkScrollBoundaries();
1238 1242
1239 deleteSelectedDateTime(); 1243 deleteSelectedDateTime();
1240 1244
1241 createDayLabels(); 1245 createDayLabels();
1242 emit incidenceSelected( 0 ); 1246 emit incidenceSelected( 0 );
1243 1247
1244 if ( globalFlagBlockAgenda == 2 ) { 1248 if ( globalFlagBlockAgenda == 2 ) {
1245 if ( KOPrefs::instance()->mSetTimeToDayStartAt ) 1249 if ( KOPrefs::instance()->mSetTimeToDayStartAt )
1246 setStartHour( KOPrefs::instance()->mDayBegins ); 1250 setStartHour( KOPrefs::instance()->mDayBegins );
1247 else if ( KOPrefs::instance()->mCenterOnCurrentTime ) 1251 else if ( KOPrefs::instance()->mCenterOnCurrentTime )
1248 setStartHour( QTime::currentTime ().hour() ); 1252 setStartHour( QTime::currentTime ().hour() );
1249 // qApp->processEvents(); 1253 // qApp->processEvents();
1250 } 1254 }
1251 qApp->processEvents(); 1255 qApp->processEvents();
1252 //qDebug("qApp->processEvents(); END "); 1256 //qDebug("qApp->processEvents(); END ");
1253 globalFlagBlockAgenda = 0; 1257 globalFlagBlockAgenda = 0;
1254 1258
1255 // mAgenda->hideUnused(); 1259 // mAgenda->hideUnused();
1256 //mAllDayAgenda->hideUnused(); 1260 //mAllDayAgenda->hideUnused();
1257 mAllDayAgenda->drawContentsToPainter(); 1261 mAllDayAgenda->drawContentsToPainter();
1258 mAgenda->drawContentsToPainter(); 1262 mAgenda->drawContentsToPainter();
1259 repaintAgenda(); 1263 repaintAgenda();
1264 onlyOne = false;
1260 // mAgenda->finishUpdate(); 1265 // mAgenda->finishUpdate();
1261 //mAllDayAgenda->finishUpdate(); 1266 //mAllDayAgenda->finishUpdate();
1262 1267
1263 // repaintAgenda(); 1268 // repaintAgenda();
1264 //qApp->processEvents(); 1269 //qApp->processEvents();
1265 // globalFlagBlockAgenda = 0; 1270 // globalFlagBlockAgenda = 0;
1266} 1271}
1267void KOAgendaView::repaintAgenda() 1272void KOAgendaView::repaintAgenda()
1268{ 1273{
1269 // mAllDayAgenda->drawContentsToPainter(); 1274 // mAllDayAgenda->drawContentsToPainter();
1270// mAllDayAgenda->viewport()->repaint( false ); 1275// mAllDayAgenda->viewport()->repaint( false );
1271// mAgenda->drawContentsToPainter(); 1276// mAgenda->drawContentsToPainter();
1272// mAgenda->viewport()->repaint( false ); 1277// mAgenda->viewport()->repaint( false );
1273// qApp->processEvents(); 1278// qApp->processEvents();
1274 1279
1275 //qDebug("KOAgendaView::repaintAgenda() "); 1280 //qDebug("KOAgendaView::repaintAgenda() ");
1276 //qApp->processEvents(); 1281 //qApp->processEvents();
1277 mAgenda->viewport()->repaint( false ); 1282 mAgenda->viewport()->repaint( false );
1278 mAllDayAgenda->viewport()->repaint( false ); 1283 mAllDayAgenda->viewport()->repaint( false );
1279 mAgenda->finishUpdate(); 1284 mAgenda->finishUpdate();
1280 mAllDayAgenda->finishUpdate(); 1285 mAllDayAgenda->finishUpdate();
1281} 1286}
1282 1287
1283 1288
1284void KOAgendaView::clearView() 1289void KOAgendaView::clearView()
1285{ 1290{
1286 // kdDebug() << "ClearView" << endl; 1291 // kdDebug() << "ClearView" << endl;
1287 mAllDayAgenda->clear(); 1292 mAllDayAgenda->clear();
1288 mAgenda->clear(); 1293 mAgenda->clear();
1289} 1294}
1290 1295
1291void KOAgendaView::printPreview(CalPrinter *calPrinter, const QDate &fd, 1296void KOAgendaView::printPreview(CalPrinter *calPrinter, const QDate &fd,
1292 const QDate &td) 1297 const QDate &td)
1293{ 1298{
1294#ifndef KORG_NOPRINTER 1299#ifndef KORG_NOPRINTER
1295 if (fd == td) 1300 if (fd == td)
1296 calPrinter->preview(CalPrinter::Day, fd, td); 1301 calPrinter->preview(CalPrinter::Day, fd, td);
1297 else 1302 else
1298 calPrinter->preview(CalPrinter::Week, fd, td); 1303 calPrinter->preview(CalPrinter::Week, fd, td);
1299#endif 1304#endif
1300} 1305}
1301 1306
1302// void KOAgendaView::updateMovedTodo() 1307// void KOAgendaView::updateMovedTodo()
1303// { 1308// {
1304// // updateConfig(); 1309// // updateConfig();
1305// // emit updateTodoViews(); 1310// // emit updateTodoViews();
1306// } 1311// }
1307 1312
1308void KOAgendaView::newEvent(int gx, int gy) 1313void KOAgendaView::newEvent(int gx, int gy)
1309{ 1314{
1310 if (!mSelectedDates.count()) return; 1315 if (!mSelectedDates.count()) return;
1311 1316
1312 QDate day = mSelectedDates[gx]; 1317 QDate day = mSelectedDates[gx];
1313 1318
1314 QTime time = mAgenda->gyToTime(gy); 1319 QTime time = mAgenda->gyToTime(gy);
1315 QDateTime dt(day,time); 1320 QDateTime dt(day,time);
1316 // if ( dt < QDateTime::currentDateTime () ) 1321 // if ( dt < QDateTime::currentDateTime () )
1317 // dt = QDateTime::currentDateTime ().addSecs( 3600 ); 1322 // dt = QDateTime::currentDateTime ().addSecs( 3600 );
1318 emit newEventSignal(dt); 1323 emit newEventSignal(dt);
1319} 1324}
1320 1325
1321void KOAgendaView::newEvent(int gxStart, int gyStart, int gxEnd, int gyEnd) 1326void KOAgendaView::newEvent(int gxStart, int gyStart, int gxEnd, int gyEnd)
1322{ 1327{
1323 if (!mSelectedDates.count()) return; 1328 if (!mSelectedDates.count()) return;
diff --git a/korganizer/koeventviewer.h b/korganizer/koeventviewer.h
index 6ecc233..1eeb8d1 100644
--- a/korganizer/koeventviewer.h
+++ b/korganizer/koeventviewer.h
@@ -1,131 +1,131 @@
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#ifndef KOEVENTVIEWER_H 19#ifndef KOEVENTVIEWER_H
20#define KOEVENTVIEWER_H 20#define KOEVENTVIEWER_H
21// 21//
22// Viewer widget for events. 22// Viewer widget for events.
23// 23//
24 24
25#include <qtextbrowser.h> 25#include <qtextbrowser.h>
26 26
27#include <libkcal/event.h> 27#include <libkcal/event.h>
28#include <libkcal/journal.h> 28#include <libkcal/journal.h>
29 29
30 30
31using namespace KCal; 31using namespace KCal;
32 32
33#ifdef DESKTOP_VERSION 33#ifdef DESKTOP_VERSION
34 34
35#include <qradiobutton.h> 35#include <qradiobutton.h>
36#include <qpushbutton.h> 36#include <qpushbutton.h>
37#include <qlayout.h> 37#include <qlayout.h>
38#include <qdialog.h> 38#include <qdialog.h>
39#include <qlabel.h> 39#include <qlabel.h>
40#include <qbuttongroup.h> 40#include <qbuttongroup.h>
41#include <kglobal.h> 41#include <kglobal.h>
42 42
43class KOPrintPrefs : public QDialog 43class KOPrintPrefs : public QDialog
44{ 44{
45 public: 45 public:
46 KOPrintPrefs( QWidget *parent=0, const char *name=0 ) : 46 KOPrintPrefs( QWidget *parent=0, const char *name=0 ) :
47 QDialog( parent, name, true ) 47 QDialog( parent, name, true )
48 { 48 {
49 setCaption( i18n("KO/Pi Printout") ); 49 setCaption( i18n("KO/Pi Printout") );
50 QVBoxLayout* lay = new QVBoxLayout( this ); 50 QVBoxLayout* lay = new QVBoxLayout( this );
51 lay->setSpacing( 3 ); 51 lay->setSpacing( 9 );
52 lay->setMargin( 3 ); 52 lay->setMargin( 9 );
53 QLabel * lab = new QLabel( i18n("This prints the view as you see it.\n(With the complete content, of course.)\nYou may change the print layout by resizing the view.\nPrint unscaled may print several pages\ndepending on the amount of data.\nPrint scaled down will print all on one page.\nPrint scaled up/down will print all on one page,\nbut will scale up the text to page boundaries,\nif the text is smaller than the page.\nYou can select page geometry setup in the next dialog."), this ); 53 QLabel * lab = new QLabel( i18n("This prints the view as you see it.\n(With the complete content, of course.)\nYou may change the print layout by resizing the view.\nPrint unscaled may print several pages\ndepending on the amount of data.\nPrint scaled down will print all on one page.\nPrint scaled up/down will print all on one page,\nbut will scale up the text to page boundaries,\nif the text is smaller than the page.\nYou can select page geometry setup in the next dialog.\n"), this );
54 lay->addWidget( lab ); 54 lay->addWidget( lab );
55 lab->setAlignment( AlignCenter );
55 QButtonGroup* format = new QButtonGroup( 1, Horizontal, i18n("Printout Mode"), this ); 56 QButtonGroup* format = new QButtonGroup( 1, Horizontal, i18n("Printout Mode"), this );
56 lay->addWidget( format ); 57 lay->addWidget( format );
57 format->setExclusive ( true ) ; 58 format->setExclusive ( true ) ;
58 pmNo = new QRadioButton(i18n("Print unscaled"), format ); 59 pmNo = new QRadioButton(i18n("Print unscaled"), format );
59 pmScaledDown = new QRadioButton(i18n("Print scaled down to fit one page"), format ); 60 pmScaledDown = new QRadioButton(i18n("Print scaled down to fit one page"), format );
60 new QRadioButton(i18n("Print scaled up/down to fit one page"), format ); 61 new QRadioButton(i18n("Print scaled up/down to fit one page"), format );
61 pmScaledDown->setChecked( true ); 62 pmScaledDown->setChecked( true );
62 QPushButton * ok = new QPushButton( i18n("OK"), this ); 63 QPushButton * ok = new QPushButton( i18n("OK"), this );
63 lay->addWidget( ok ); 64 lay->addWidget( ok );
64 QPushButton * cancel = new QPushButton( i18n("Cancel"), this ); 65 QPushButton * cancel = new QPushButton( i18n("Cancel"), this );
65 lay->addWidget( cancel ); 66 lay->addWidget( cancel );
66 connect ( ok,SIGNAL(clicked() ),this , SLOT ( accept() ) ); 67 connect ( ok,SIGNAL(clicked() ),this , SLOT ( accept() ) );
67 connect (cancel, SIGNAL(clicked() ), this, SLOT ( reject()) ); 68 connect (cancel, SIGNAL(clicked() ), this, SLOT ( reject()) );
68 resize( 200, 200 );
69 } 69 }
70 70
71 int printMode() 71 int printMode()
72 { 72 {
73 if ( pmNo->isChecked() ) 73 if ( pmNo->isChecked() )
74 return 0; 74 return 0;
75 if ( pmScaledDown->isChecked() ) 75 if ( pmScaledDown->isChecked() )
76 return 1; 76 return 1;
77 return 2; 77 return 2;
78 } 78 }
79private: 79private:
80 QRadioButton* pmNo; 80 QRadioButton* pmNo;
81 QRadioButton* pmScaledDown; 81 QRadioButton* pmScaledDown;
82}; 82};
83 83
84#endif 84#endif
85 85
86class KOEventViewer : public QTextBrowser { 86class KOEventViewer : public QTextBrowser {
87 Q_OBJECT 87 Q_OBJECT
88 public: 88 public:
89 KOEventViewer(QWidget *parent=0,const char *name=0); 89 KOEventViewer(QWidget *parent=0,const char *name=0);
90 virtual ~KOEventViewer(); 90 virtual ~KOEventViewer();
91 91
92 void setSource(const QString &); 92 void setSource(const QString &);
93 void setEvent(Event *event); 93 void setEvent(Event *event);
94 void addEvent(Event *event); 94 void addEvent(Event *event);
95 void setTodo(Todo *event, bool clearV = true ); 95 void setTodo(Todo *event, bool clearV = true );
96 void setJournal(Journal *jour, bool clearV = true ); 96 void setJournal(Journal *jour, bool clearV = true );
97 97
98 void appendEvent(Event *event, int mode = 0 ); 98 void appendEvent(Event *event, int mode = 0 );
99 void appendTodo(Todo *event, int mode = 0 ); 99 void appendTodo(Todo *event, int mode = 0 );
100 void appendJournal(Journal *jour, int mode = 0 ); 100 void appendJournal(Journal *jour, int mode = 0 );
101 101
102 void clearEvents(bool now=false); 102 void clearEvents(bool now=false);
103 103
104 void addText(QString text); 104 void addText(QString text);
105 void setSyncMode( bool ); 105 void setSyncMode( bool );
106 void setColorMode( int ); 106 void setColorMode( int );
107 void mailToAttendees( bool all ); 107 void mailToAttendees( bool all );
108 void printMe(); 108 void printMe();
109 109
110 protected: 110 protected:
111 int mColorMode; 111 int mColorMode;
112 void addTag(const QString & tag,const QString & text); 112 void addTag(const QString & tag,const QString & text);
113 113
114 void formatCategories(Incidence *event); 114 void formatCategories(Incidence *event);
115 void formatAttendees(Incidence *event); 115 void formatAttendees(Incidence *event);
116 void formatReadOnly(Incidence *event); 116 void formatReadOnly(Incidence *event);
117 void keyPressEvent ( QKeyEvent * e ); 117 void keyPressEvent ( QKeyEvent * e );
118 118
119 private: 119 private:
120 QTextBrowser *mEventTextView; 120 QTextBrowser *mEventTextView;
121 bool mSyncMode; 121 bool mSyncMode;
122 QString deTag(QString text); 122 QString deTag(QString text);
123 123
124 QString mText; 124 QString mText;
125 QString mMailSubject; 125 QString mMailSubject;
126 Incidence* mCurrentIncidence; 126 Incidence* mCurrentIncidence;
127 signals: 127 signals:
128 void launchaddressbook(QString uid); 128 void launchaddressbook(QString uid);
129}; 129};
130 130
131#endif 131#endif