Diffstat (limited to 'korganizer/koeventviewer.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r-- | korganizer/koeventviewer.cpp | 4 |
1 files changed, 0 insertions, 4 deletions
diff --git a/korganizer/koeventviewer.cpp b/korganizer/koeventviewer.cpp index fefc778..f39b5e1 100644 --- a/korganizer/koeventviewer.cpp +++ b/korganizer/koeventviewer.cpp | |||
@@ -54,169 +54,165 @@ | |||
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 | ||
64 | KOEventViewer::KOEventViewer(QWidget *parent,const char *name) | 64 | KOEventViewer::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 | ||
71 | KOEventViewer::~KOEventViewer() | 71 | KOEventViewer::~KOEventViewer() |
72 | { | 72 | { |
73 | } | 73 | } |
74 | 74 | ||
75 | void KOEventViewer::printMe() | 75 | void 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 | } |
112 | void KOEventViewer::setSource(const QString& n) | 110 | void 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 | } |