kitchensync

syncprocessmanager.h

00001 /*
00002     This file is part of KitchenSync.
00003 
00004     Copyright (c) 2005 Cornelius Schumacher <schumacher@kde.org>
00005 
00006     This program is free software; you can redistribute it and/or modify
00007     it under the terms of the GNU General Public License as published by
00008     the Free Software Foundation; either version 2 of the License, or
00009     (at your option) any later version.
00010 
00011     This program is distributed in the hope that it will be useful,
00012     but WITHOUT ANY WARRANTY; without even the implied warranty of
00013     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
00014     GNU General Public License for more details.
00015 
00016     You should have received a copy of the GNU General Public License
00017     along with this program; if not, write to the Free Software
00018     Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,
00019     USA.
00020 */
00021 #ifndef SYNCPROCESSMANAGER_H
00022 #define SYNCPROCESSMANAGER_H
00023 
00024 #include <tqobject.h>
00025 
00026 #include <libqopensync/group.h>
00027 
00028 namespace QSync {
00029 class Environment;
00030 }
00031 
00032 class SyncProcess;
00033 
00034 class SyncProcessManager : public QObject
00035 {
00036     Q_OBJECT
00037   public:
00038     static SyncProcessManager *self();
00039 
00043     ~SyncProcessManager();
00044 
00048     QSync::Environment *environment() const { return mEnvironment; }
00049 
00053     int count() const;
00054 
00058     SyncProcess* at( int pos ) const;
00059 
00063     SyncProcess* byGroup( const QSync::Group &group );
00064 
00068     SyncProcess* byGroupName( const TQString &name );
00069 
00073     void addGroup( const TQString &name );
00074 
00078     void remove( SyncProcess *syncProcess );
00079 
00083     QSync::Result addMember( SyncProcess *process, const QSync::Plugin &plugin );
00084 
00085   signals:
00086     void changed();
00087     void syncProcessChanged( SyncProcess *process );
00088 
00089   private:
00090     SyncProcessManager();
00091 
00092     void init( QSync::Environment *environment );
00093 
00094     TQValueList<SyncProcess*> mProcesses;
00095     QSync::Environment *mEnvironment;
00096 
00097     static SyncProcessManager *mSelf;
00098 };
00099 
00100 #endif