summaryrefslogtreecommitdiffabout
path: root/korganizer
Unidiff
Diffstat (limited to 'korganizer') (more/less context) (show whitespace changes)
-rw-r--r--korganizer/koeventviewer.cpp2
-rw-r--r--korganizer/kowhatsnextview.cpp42
-rw-r--r--korganizer/kowhatsnextview.h5
3 files changed, 33 insertions, 16 deletions
diff --git a/korganizer/koeventviewer.cpp b/korganizer/koeventviewer.cpp
index cee0466..5de667e 100644
--- a/korganizer/koeventviewer.cpp
+++ b/korganizer/koeventviewer.cpp
@@ -78,25 +78,25 @@ void KOEventViewer::setSource(const QString& n)
78 KABC::StdAddressBook* AddressBook = KABC::StdAddressBook::self( true ); 78 KABC::StdAddressBook* AddressBook = KABC::StdAddressBook::self( true );
79 KABC::AddressBook::Iterator it; 79 KABC::AddressBook::Iterator it;
80 for( it = AddressBook->begin(); it != AddressBook->end(); ++it ) { 80 for( it = AddressBook->begin(); it != AddressBook->end(); ++it ) {
81 // LR I do not understand, why the uid string is different on zaurus and desktop 81 // LR I do not understand, why the uid string is different on zaurus and desktop
82 QString uid = "uid://"+(*it).uid(); 82 QString uid = "uid://"+(*it).uid();
83 83
84 //qDebug("for *%s* +%s+ ", n.latin1(), uid.latin1()); 84 //qDebug("for *%s* +%s+ ", n.latin1(), uid.latin1());
85 if (n == uid ) { 85 if (n == uid ) {
86 //qDebug("found %s ",(*it).mobileHomePhone().latin1() ); 86 //qDebug("found %s ",(*it).mobileHomePhone().latin1() );
87 QDialog dia( this,"dia123", true ); 87 QDialog dia( this,"dia123", true );
88 dia.setCaption( i18n("Details of attendee") ); 88 dia.setCaption( i18n("Details of attendee") );
89 QVBoxLayout lay ( &dia ); 89 QVBoxLayout lay ( &dia );
90 KPIM::AddresseeView av ( &dia ); 90 KABC::AddresseeView av ( &dia );
91 av.setAddressee( (*it) ); 91 av.setAddressee( (*it) );
92 lay.addWidget( &av ); 92 lay.addWidget( &av );
93 if ( QApplication::desktop()->width() < 480 ) 93 if ( QApplication::desktop()->width() < 480 )
94 dia.resize( 220, 240); 94 dia.resize( 220, 240);
95 else { 95 else {
96 dia.resize( 400,400); 96 dia.resize( 400,400);
97 } 97 }
98 dia.exec(); 98 dia.exec();
99 break; 99 break;
100 } 100 }
101 } 101 }
102 return; 102 return;
diff --git a/korganizer/kowhatsnextview.cpp b/korganizer/kowhatsnextview.cpp
index 219f7c3..7166a01 100644
--- a/korganizer/kowhatsnextview.cpp
+++ b/korganizer/kowhatsnextview.cpp
@@ -15,25 +15,27 @@
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 19
20#include <qlayout.h> 20#include <qlayout.h>
21#include <qtextbrowser.h> 21#include <qtextbrowser.h>
22#include <qtextcodec.h> 22#include <qtextcodec.h>
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 27#ifdef DESKTOP_VERSION
28#include <qpaintdevicemetrics.h>
29#endif
28#include <kglobal.h> 30#include <kglobal.h>
29#include <klocale.h> 31#include <klocale.h>
30#include <kdebug.h> 32#include <kdebug.h>
31#include <kiconloader.h> 33#include <kiconloader.h>
32#include <kmessagebox.h> 34#include <kmessagebox.h>
33 35
34#include <libkcal/calendar.h> 36#include <libkcal/calendar.h>
35 37
36#ifndef KORG_NOPRINTER 38#ifndef KORG_NOPRINTER
37#include "calprinter.h" 39#include "calprinter.h"
38#endif 40#endif
39#include "koglobals.h" 41#include "koglobals.h"
@@ -47,24 +49,49 @@ void WhatsNextTextBrowser::setSource(const QString& n)
47{ 49{
48 50
49 if (n.startsWith("event:")) { 51 if (n.startsWith("event:")) {
50 emit showIncidence(n); 52 emit showIncidence(n);
51 return; 53 return;
52 } else if (n.startsWith("todo:")) { 54 } else if (n.startsWith("todo:")) {
53 emit showIncidence(n); 55 emit showIncidence(n);
54 return; 56 return;
55 } else { 57 } else {
56 QTextBrowser::setSource(n); 58 QTextBrowser::setSource(n);
57 } 59 }
58} 60}
61void WhatsNextTextBrowser::printMe()
62{
63#ifdef DESKTOP_VERSION
64 QPrinter printer;
65 if (!printer.setup() )
66 return;
67 QPainter p;
68 p.begin ( &printer );
69 QPaintDeviceMetrics m = QPaintDeviceMetrics ( &printer );
70 float dx, dy;
71 int wid = (m.width() * 9)/10;
72 dx = (float) wid/(float)contentsWidth ();
73 dy = (float)(m.height()) / (float)contentsHeight ();
74 float scale;
75 // scale to fit the width or height of the paper
76 if ( dx < dy )
77 scale = dx;
78 else
79 scale = dy;
80 p.translate( m.width()/10,0 );
81 p.scale( scale, scale );
82 drawContents ( &p, 0,0, contentsWidth (), contentsHeight () );
83 p.end();
84#endif
85}
59 86
60KOWhatsNextView::KOWhatsNextView(Calendar *calendar, QWidget *parent, 87KOWhatsNextView::KOWhatsNextView(Calendar *calendar, QWidget *parent,
61 const char *name) 88 const char *name)
62 : KOrg::BaseView(calendar, parent, name) 89 : KOrg::BaseView(calendar, parent, name)
63{ 90{
64 // mDateLabel = 91 // mDateLabel =
65 // new QLabel(KGlobal::locale()->formatDate(QDate::currentDate()),this); 92 // new QLabel(KGlobal::locale()->formatDate(QDate::currentDate()),this);
66 // mDateLabel->setMargin(2); 93 // mDateLabel->setMargin(2);
67 // mDateLabel->setAlignment(AlignCenter); 94 // mDateLabel->setAlignment(AlignCenter);
68 setFont( KOPrefs::instance()->mWhatsNextFont ); 95 setFont( KOPrefs::instance()->mWhatsNextFont );
69 mView = new WhatsNextTextBrowser(this); 96 mView = new WhatsNextTextBrowser(this);
70 connect(mView,SIGNAL(showIncidence(const QString &)),SLOT(showIncidence(const QString &))); 97 connect(mView,SIGNAL(showIncidence(const QString &)),SLOT(showIncidence(const QString &)));
@@ -105,36 +132,25 @@ int KOWhatsNextView::currentDateCount()
105} 132}
106 133
107QPtrList<Incidence> KOWhatsNextView::selectedIncidences() 134QPtrList<Incidence> KOWhatsNextView::selectedIncidences()
108{ 135{
109 QPtrList<Incidence> eventList; 136 QPtrList<Incidence> eventList;
110 137
111 return eventList; 138 return eventList;
112} 139}
113 140
114void KOWhatsNextView::printMe() 141void KOWhatsNextView::printMe()
115{ 142{
116#ifdef DESKTOP_VERSION 143#ifdef DESKTOP_VERSION
117 QPrinter printer; 144 mView->printMe();
118 if (!printer.setup() )
119 return;
120 QTextBrowser tb;
121 tb.setFixedSize( 600, 4000 );
122 QPainter::redirect ( tb.viewport(), &printer );
123 updateView();
124 tb.setText( mText );
125 tb.show();
126 tb.repaint();
127 tb.hide();
128 KMessageBox::information( this, i18n("Printing What's Next View!\n\nPlease close after\nprinting is finished."));
129#endif 145#endif
130} 146}
131void KOWhatsNextView::printPreview(CalPrinter *calPrinter, const QDate &fd, 147void KOWhatsNextView::printPreview(CalPrinter *calPrinter, const QDate &fd,
132 const QDate &td) 148 const QDate &td)
133{ 149{
134#ifndef KORG_NOPRINTER 150#ifndef KORG_NOPRINTER
135 calPrinter->preview(CalPrinter::Day, fd, td); 151 calPrinter->preview(CalPrinter::Day, fd, td);
136#endif 152#endif
137} 153}
138void KOWhatsNextView::updateConfig() 154void KOWhatsNextView::updateConfig()
139{ 155{
140 setFont( KOPrefs::instance()->mWhatsNextFont ); 156 setFont( KOPrefs::instance()->mWhatsNextFont );
diff --git a/korganizer/kowhatsnextview.h b/korganizer/kowhatsnextview.h
index 0231cf2..715037f 100644
--- a/korganizer/kowhatsnextview.h
+++ b/korganizer/kowhatsnextview.h
@@ -25,27 +25,28 @@
25#include <korganizer/baseview.h> 25#include <korganizer/baseview.h>
26 26
27class QListView; 27class QListView;
28class QLabel; 28class QLabel;
29 29
30class KOEventViewerDialog; 30class KOEventViewerDialog;
31 31
32#include <qpainter.h> 32#include <qpainter.h>
33#include <qwidget.h> 33#include <qwidget.h>
34class WhatsNextTextBrowser : public QTextBrowser { 34class WhatsNextTextBrowser : public QTextBrowser {
35 Q_OBJECT 35 Q_OBJECT
36 public: 36 public:
37 WhatsNextTextBrowser(QWidget *parent) : QTextBrowser(parent) {} 37 WhatsNextTextBrowser(QWidget *parent) : QTextBrowser(parent) {};
38 38
39 void setSource(const QString &); 39 void setSource(const QString &);
40 void printMe();
40 41
41 signals: 42 signals:
42 void showIncidence(const QString &uid); 43 void showIncidence(const QString &uid);
43}; 44};
44 45
45 46
46/** 47/**
47 This class provides a view of the next events and todos 48 This class provides a view of the next events and todos
48*/ 49*/
49class KOWhatsNextView : public KOrg::BaseView 50class KOWhatsNextView : public KOrg::BaseView
50{ 51{
51 Q_OBJECT 52 Q_OBJECT
@@ -79,21 +80,21 @@ class KOWhatsNextView : public KOrg::BaseView
79 QDate mEventDate; 80 QDate mEventDate;
80 virtual void showEvent ( QShowEvent * ); 81 virtual void showEvent ( QShowEvent * );
81 virtual void hideEvent ( QHideEvent * ); 82 virtual void hideEvent ( QHideEvent * );
82 83
83 private slots: 84 private slots:
84 void showIncidence(const QString &); 85 void showIncidence(const QString &);
85 void restartTimer(); 86 void restartTimer();
86 87
87 88
88 private: 89 private:
89 //void createEventViewer(); 90 //void createEventViewer();
90 QTimer* mTimer; 91 QTimer* mTimer;
91 QTextBrowser *mView; 92 WhatsNextTextBrowser *mView;
92 QString mText; 93 QString mText;
93 // QLabel *mDateLabel; 94 // QLabel *mDateLabel;
94 KOEventViewerDialog *mEventViewer; 95 KOEventViewerDialog *mEventViewer;
95 96
96 QValueList<Incidence *> mTodos; 97 QValueList<Incidence *> mTodos;
97}; 98};
98 99
99#endif 100#endif