kitchensync

groupitem.h

00001 /*
00002     This file is part of KitchenSync.
00003 
00004     Copyright (c) 2005 Tobias Koenig <tokoe@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, USA.
00019 */
00020 
00021 #ifndef GROUPITEM_H
00022 #define GROUPITEM_H
00023 
00024 #include "syncprocess.h"
00025 
00026 #include <libqopensync/callbackhandler.h>
00027 
00028 #include <kwidgetlist.h>
00029 
00030 namespace QSync {
00031 class Engine;
00032 }
00033 
00034 class MemberItem;
00035 class KURLLabel;
00036 class QLabel;
00037 class QProgressBar;
00038 class QVBox;
00039 
00040 class GroupItem : public KWidgetListItem
00041 {
00042   Q_OBJECT
00043 
00044   public:
00045     GroupItem( KWidgetList*, SyncProcess *syncProcess );
00046     ~GroupItem();
00047 
00048     SyncProcess *syncProcess() const { return mSyncProcess; }
00049 
00050     void update();
00051 
00052     void clear();
00053 
00054   signals:
00055     void synchronizeGroup( SyncProcess *syncProcess );
00056     void abortSynchronizeGroup( SyncProcess *syncProcess );
00057     void configureGroup( SyncProcess *syncProcess );
00058 
00059   protected slots:
00060     void conflict( QSync::SyncMapping );
00061     void change( const QSync::SyncChangeUpdate& );
00062     void mapping( const QSync::SyncMappingUpdate& );
00063     void engine( const QSync::SyncEngineUpdate& );
00064     void member( const QSync::SyncMemberUpdate& );
00065 
00066     void synchronize();
00067     void configure();
00068 
00069     void engineChanged( QSync::Engine *engine );
00070 
00071   private:
00072     SyncProcess *mSyncProcess;
00073     QSync::CallbackHandler *mCallbackHandler;
00074     QValueList<MemberItem*> mMemberItems;
00075 
00076     QLabel *mIcon;
00077     QLabel *mGroupName;
00078     QLabel *mStatus;
00079     QLabel *mTime;
00080     KURLLabel *mSyncAction;
00081     KURLLabel *mConfigureAction;
00082     QVBox *mBox;
00083     QProgressBar *mProgressBar;
00084 
00085     int mProcessedItems;
00086     int mMaxProcessedItems;
00087     bool mSynchronizing;
00088 };
00089 
00090 class MemberItem : public QWidget
00091 {
00092   public:
00093     MemberItem( QWidget *parent, SyncProcess *syncProcess,
00094                 const QSync::Member &member );
00095 
00096     SyncProcess* syncProcess() const { return mSyncProcess; }
00097     QSync::Member member() const { return mMember; }
00098 
00099     void setStatusMessage( const QString &msg );
00100 
00101   private:
00102     SyncProcess *mSyncProcess;
00103     QSync::Member mMember;
00104 
00105     QLabel *mIcon;
00106     QLabel *mMemberName;
00107     QLabel *mDescription;
00108     QLabel *mStatus;
00109 };
00110 
00111 #endif