• Skip to content
  • Skip to link menu
KDE 4.2 API Reference
  • KDE API Reference
  • kdepim
  • Sitemap
  • Contact Us
 

akonadi/clients

storecommand.cpp

Go to the documentation of this file.
00001 /*
00002     Copyright (c) 2007 Bruno Virlet <bruno.virlet@gmail.com>
00003 
00004     This library is free software; you can redistribute it and/or modify it
00005     under the terms of the GNU Library General Public License as published by
00006     the Free Software Foundation; either version 2 of the License, or (at your
00007     option) any later version.
00008 
00009     This library is distributed in the hope that it will be useful, but WITHOUT
00010     ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
00011     FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Library General Public
00012     License for more details.
00013 
00014     You should have received a copy of the GNU Library General Public License
00015     along with this library; see the file COPYING.LIB.  If not, write to the
00016     Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
00017     02110-1301, USA.
00018 */
00019 
00020 #include "storecommand.h"
00021 #include "out.h"
00022 
00023 #include <akonadi/itemmodifyjob.h>
00024 #include <akonadi/itemfetchjob.h>
00025 #include <akonadi/itemfetchscope.h>
00026 
00027 using namespace Akonadi;
00028 
00029 StoreCommand::StoreCommand(const QString & uid, const QString & content) :
00030   mUid( uid ), mContent( content )
00031 {
00032 }
00033 
00034 void StoreCommand::exec()
00035 {
00036   const Item item( mUid.toLongLong() );
00037   ItemFetchJob* fetchJob = new ItemFetchJob( item );
00038   if ( !fetchJob->exec() ) {
00039     err() << "Error fetching item '" << mUid << "': "
00040         << fetchJob->errorString()
00041         << endl;
00042   } else {
00043     Item item = fetchJob->items()[0];
00044     item.setPayloadFromData( mContent.toUtf8() );
00045     ItemModifyJob* sJob = new ItemModifyJob( item );
00046     if ( !sJob->exec() ) {
00047       err() << "Unable to store data " << mContent << " for item " << mUid <<":"
00048             << sJob->errorString()
00049             << endl;
00050     }
00051     else
00052       out() << "Data stored for item " << mUid << endl;
00053   }
00054 }

akonadi/clients

Skip menu "akonadi/clients"
  • Main Page
  • Namespace List
  • Class Hierarchy
  • Alphabetical List
  • Class List
  • File List
  • Class Members

kdepim

Skip menu "kdepim"
  • akonadi
  •   clients
  •   kabc
  •   kcal
  •   kcm
  • akregator
  • console
  •   kabcclient
  •   konsolekalendar
  • kaddressbook
  • kalarm
  •   lib
  • kdgantt
  • kdgantt1
  • kjots
  • kleopatra
  • kmail
  • kmobiletools
  • knode
  • knotes
  • kontact
  • kontactinterfaces
  • korganizer
  •   korgac
  • kpilot
  • ktimetracker
  • libkdepim
  • libkholidays
  • libkleo
  • libkpgp
  • maildir
Generated for kdepim by doxygen 1.5.4
This website is maintained by Adriaan de Groot and Allen Winter.
KDE® and the K Desktop Environment® logo are registered trademarks of KDE e.V. | Legal