• Skip to content
  • Skip to link menu
  • KDE API Reference
  • kdepimlibs-4.14.10 API Reference
  • KDE Home
  • Contact Us
 

kabc

  • kabc
  • plugins
  • net
resourcenet.h
1/*
2 This file is part of libkabc.
3 Copyright (c) 2003 Tobias Koenig <tokoe@kde.org>
4
5 This library is free software; you can redistribute it and/or
6 modify it under the terms of the GNU Library General Public
7 License as published by the Free Software Foundation; either
8 version 2 of the License, or (at your option) any later version.
9
10 This library is distributed in the hope that it will be useful,
11 but WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 Library General Public License for more details.
14
15 You should have received a copy of the GNU Library General Public License
16 along with this library; see the file COPYING.LIB. If not, write to
17 the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
18 Boston, MA 02110-1301, USA.
19*/
20
21#ifndef KABC_RESOURCENET_H
22#define KABC_RESOURCENET_H
23
24#include "kabc_net_export.h"
25
26#include "kabc/resource.h"
27#include <sys/types.h>
28
29class QFile;
30class KTemporaryFile;
31
32class KJob;
33
34namespace KABC {
35
36class Format;
37
41class KABC_NET_EXPORT ResourceNet : public Resource
42{
43 Q_OBJECT
44
45 public:
46 ResourceNet();
47 explicit ResourceNet( const KConfigGroup &group );
48 ResourceNet( const KUrl &url, const QString &format );
49 ~ResourceNet();
50
51 virtual void writeConfig( KConfigGroup &group );
52
53 virtual bool doOpen();
54 virtual void doClose();
55
56 virtual Ticket *requestSaveTicket();
57 virtual void releaseSaveTicket( Ticket *ticket );
58
59 virtual bool load();
60 virtual bool asyncLoad();
61 virtual bool save( Ticket *ticket );
62 virtual bool asyncSave( Ticket *ticket );
63
67 void setUrl( const KUrl &url );
68
72 KUrl url() const;
73
77 void setFormat( const QString &name );
78
82 QString format() const;
83
84 protected:
85 void init( const KUrl &url, const QString &format );
86
87 private Q_SLOTS:
88 void downloadFinished( KJob *job );
89 void uploadFinished( KJob *job );
90
91 private:
92 bool clearAndLoad( QFile *file );
93 void saveToFile( QFile *file );
94 bool hasTempFile() const { return mTempFile != 0; }
95 void abortAsyncLoading();
96 void abortAsyncSaving();
97 bool createLocalTempFile();
98 void deleteLocalTempFile();
99 void deleteStaleTempFile();
100
101 Format *mFormat;
102 QString mFormatName;
103
104 KUrl mUrl;
105 KTemporaryFile *mTempFile;
106
107 class ResourceNetPrivate;
108 ResourceNetPrivate *d;
109};
110
111}
112
113#endif
KABC::Format
Base class for address book formats.
Definition format.h:43
KABC::ResourceNet::requestSaveTicket
virtual Ticket * requestSaveTicket()
Request a ticket, you have to pass through save() to allow locking.
Definition resourcenet.cpp:120
KABC::ResourceNet::setFormat
void setFormat(const QString &name)
Sets a new format by name.
Definition resourcenet.cpp:334
KABC::ResourceNet::releaseSaveTicket
virtual void releaseSaveTicket(Ticket *ticket)
Releases the ticket previousely requested with requestSaveTicket().
Definition resourcenet.cpp:127
KABC::ResourceNet::save
virtual bool save(Ticket *ticket)
Saves all addressees synchronously.
Definition resourcenet.cpp:230
KABC::ResourceNet::url
KUrl url() const
Return url of directory used for loading and saving the address book.
Definition resourcenet.cpp:329
KABC::ResourceNet::format
QString format() const
Returns the format name.
Definition resourcenet.cpp:343
KABC::ResourceNet::writeConfig
virtual void writeConfig(KConfigGroup &group)
Writes the resource specific config to file.
Definition resourcenet.cpp:112
KABC::ResourceNet::asyncLoad
virtual bool asyncLoad()
Loads all addressees asyncronously.
Definition resourcenet.cpp:173
KABC::ResourceNet::setUrl
void setUrl(const KUrl &url)
Set url of directory to be used for saving.
Definition resourcenet.cpp:324
KABC::ResourceNet::asyncSave
virtual bool asyncSave(Ticket *ticket)
Saves all addressees asynchronously.
Definition resourcenet.cpp:260
KABC::ResourceNet::load
virtual bool load()
Loads all addressees synchronously.
Definition resourcenet.cpp:141
KABC::Resource::Resource
Resource()
Default constructor.
Definition resource.cpp:218
KABC::Ticket
Helper class for handling coordinated save of address books.
Definition resource.h:38
KABC
Class that holds a Calendar Url (FBURL/CALADRURI/CALURI)
Definition address.h:29
This file is part of the KDE documentation.
Documentation copyright © 1996-2025 The KDE developers.
Generated on Fri Jan 17 2025 00:00:00 by doxygen 1.13.2 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.

kabc

Skip menu "kabc"
  • Main Page
  • Namespace List
  • Namespace Members
  • Alphabetical List
  • Class List
  • Class Hierarchy
  • Class Members
  • File List
  • Related Pages

kdepimlibs-4.14.10 API Reference

Skip menu "kdepimlibs-4.14.10 API Reference"
  • akonadi
  •   contact
  •   kmime
  •   socialutils
  • kabc
  • kalarmcal
  • kblog
  • kcal
  • kcalcore
  • kcalutils
  • kholidays
  • kimap
  • kioslave
  •   imap4
  •   mbox
  •   nntp
  • kldap
  • kmbox
  • kmime
  • kontactinterface
  • kpimidentities
  • kpimtextedit
  • kpimutils
  • kresources
  • ktnef
  • kxmlrpcclient
  • mailtransport
  • microblog
  • qgpgme
  • syndication
  •   atom
  •   rdf
  •   rss2
Report problems with this website to our bug tracking system.
Contact the specific authors with questions and comments about the page contents.

KDE® and the K Desktop Environment® logo are registered trademarks of KDE e.V. | Legal