~ubuntu-branches/ubuntu/oneiric/kdepim/oneiric-updates

« back to all changes in this revision

Viewing changes to kontact/plugins/korganizer/todoplugin.cpp

  • Committer: Package Import Robot
  • Author(s): Philip Muškovac
  • Date: 2011-06-28 19:33:24 UTC
  • mfrom: (0.2.13) (0.1.13 sid)
  • Revision ID: package-import@ubuntu.com-20110628193324-8yvjs8sdv9rdoo6c
Tags: 4:4.7.0-0ubuntu1
* New upstream release
  - update install files
  - add missing kdepim-doc package to control file
  - Fix Vcs lines
  - kontact breaks/replaces korganizer << 4:4.6.80
  - tighten the dependency of kdepim-dev on libkdepim4 to fix lintian error

Show diffs side-by-side

added added

removed removed

Lines of Context:
27
27
#include "korg_uniqueapp.h"
28
28
#include "todosummarywidget.h"
29
29
 
30
 
#include <libkdepim/kdepimprotocols.h>
31
 
#include <libkdepim/kvcarddrag.h>
32
30
#include <libkdepim/maillistdrag.h>
33
31
 
34
 
#include <KCal/CalendarLocal>
35
 
#include <KCal/ICalDrag>
 
32
#include <KABC/VCardDrag>
 
33
 
 
34
#include <kcalcore/memorycalendar.h>
 
35
#include <kcalutils/icaldrag.h>
36
36
 
37
37
#include <KontactInterface/Core>
38
38
 
151
151
 
152
152
void TodoPlugin::slotSyncTodos()
153
153
{
 
154
#if 0
154
155
  QDBusMessage message =
155
156
      QDBusMessage::createMethodCall( "org.kde.kmail", "/Groupware",
156
157
                                      "org.kde.kmail.groupware",
157
158
                                      "triggerSync" );
158
159
  message << QString( "Todo" );
159
160
  QDBusConnection::sessionBus().send( message );
 
161
#else
 
162
  kWarning()<<" TodoPlugin::slotSyncTodos : need to port to Akonadi";
 
163
#endif
160
164
}
161
165
 
162
166
bool TodoPlugin::createDBUSInterface( const QString &serviceType )
174
178
  return
175
179
    mimeData->hasText() ||
176
180
    KPIM::MailList::canDecode( mimeData ) ||
177
 
    KPIM::KVCardDrag::canDecode( mimeData ) ||
178
 
    KCal::ICalDrag::canDecode( mimeData );
 
181
    KABC::VCardDrag::canDecode( mimeData ) ||
 
182
    KCalUtils::ICalDrag::canDecode( mimeData );
179
183
}
180
184
 
181
185
bool TodoPlugin::isRunningStandalone() const
187
191
{
188
192
  const QMimeData *md = event->mimeData();
189
193
 
190
 
  if ( KPIM::KVCardDrag::canDecode( md ) ) {
 
194
  if ( KABC::VCardDrag::canDecode( md ) ) {
191
195
    KABC::Addressee::List contacts;
192
196
 
193
 
    KPIM::KVCardDrag::fromMimeData( md, contacts );
 
197
    KABC::VCardDrag::fromMimeData( md, contacts );
194
198
 
195
199
    KABC::Addressee::List::Iterator it;
196
200
 
209
213
    return;
210
214
  }
211
215
 
212
 
  if ( KCal::ICalDrag::canDecode( event->mimeData() ) ) {
213
 
    KCal::CalendarLocal cal( KSystemTimeZones::local() );
214
 
    if ( KCal::ICalDrag::fromMimeData( event->mimeData(), &cal ) ) {
215
 
      KCal::Incidence::List incidences = cal.incidences();
 
216
  if ( KCalUtils::ICalDrag::canDecode( event->mimeData() ) ) {
 
217
    KCalCore::MemoryCalendar::Ptr cal( new KCalCore::MemoryCalendar( KSystemTimeZones::local() ) );
 
218
    if ( KCalUtils::ICalDrag::fromMimeData( event->mimeData(), cal ) ) {
 
219
      KCalCore::Incidence::List incidences = cal->incidences();
216
220
      Q_ASSERT( incidences.count() );
217
221
      if ( !incidences.isEmpty() ) {
218
222
        event->accept();
219
 
        KCal::Incidence *i = incidences.first();
 
223
        KCalCore::Incidence::Ptr i = incidences.first();
220
224
        QString summary;
221
 
        if ( dynamic_cast<KCal::Journal*>( i ) ) {
 
225
        if ( i->type() == KCalCore::Incidence::TypeJournal ) {
222
226
          summary = i18nc( "@item", "Note: %1", i->summary() );
223
227
        } else {
224
228
          summary = i->summary();
247
251
      KPIM::MailSummary mail = mails.first();
248
252
      QString txt = i18nc( "@item", "From: %1\nTo: %2\nSubject: %3",
249
253
                           mail.from(), mail.to(), mail.subject() );
250
 
      QString uri = KDEPIMPROTOCOL_EMAIL +
 
254
      QString uri = QLatin1String( "kmail:" ) +
251
255
                    QString::number( mail.serialNumber() ) + '/' +
252
256
                    mail.messageId();
253
257
      KTemporaryFile tf;
255
259
      tf.write( event->encodedData( "message/rfc822" ) );
256
260
      interface()->openTodoEditor(
257
261
        i18nc( "@item", "Mail: %1", mail.subject() ),
258
 
        txt, uri, tf.fileName(), QStringList(), "message/rfc822", false );
 
262
        txt, uri, tf.fileName(), QStringList(), "message/rfc822" );
259
263
      tf.close();
260
264
    }
261
265
    return;