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 TQLabel;
00037 class TQProgressBar;
00038 class TQVBox;
00039 
00040 class GroupItem : public KWidgetListItem
00041 {
00042   Q_OBJECT
00043   
00044 
00045   public:
00046     GroupItem( KWidgetList*, SyncProcess *syncProcess );
00047     ~GroupItem();
00048 
00049     SyncProcess *syncProcess() const { return mSyncProcess; }
00050 
00051     void update();
00052 
00053     void clear();
00054 
00055   signals:
00056     void synchronizeGroup( SyncProcess *syncProcess );
00057     void abortSynchronizeGroup( SyncProcess *syncProcess );
00058     void configureGroup( SyncProcess *syncProcess );
00059 
00060   protected slots:
00061     void conflict( QSync::SyncMapping );
00062     void change( const QSync::SyncChangeUpdate& );
00063     void mapping( const QSync::SyncMappingUpdate& );
00064     void engine( const QSync::SyncEngineUpdate& );
00065     void member( const QSync::SyncMemberUpdate& );
00066 
00067     void synchronize();
00068     void configure();
00069 
00070     void engineChanged( QSync::Engine *engine );
00071 
00072   private:
00073     SyncProcess *mSyncProcess;
00074     QSync::CallbackHandler *mCallbackHandler;
00075     TQValueList<MemberItem*> mMemberItems;
00076 
00077     TQLabel *mIcon;
00078     TQLabel *mGroupName;
00079     TQLabel *mStatus;
00080     TQLabel *mTime;
00081     KURLLabel *mSyncAction;
00082     KURLLabel *mConfigureAction;
00083     TQVBox *mBox;
00084     TQProgressBar *mProgressBar;
00085 
00086     int mProcessedItems;
00087     int mMaxProcessedItems;
00088     bool mSynchronizing;
00089 };
00090 
00091 class MemberItem : public TQWidget
00092 {
00093   public:
00094     MemberItem( TQWidget *parent, SyncProcess *syncProcess,
00095                 const QSync::Member &member );
00096 
00097     SyncProcess* syncProcess() const { return mSyncProcess; }
00098     QSync::Member member() const { return mMember; }
00099 
00100     void setStatusMessage( const TQString &msg );
00101 
00102   private:
00103     SyncProcess *mSyncProcess;
00104     QSync::Member mMember;
00105 
00106     TQLabel *mIcon;
00107     TQLabel *mMemberName;
00108     TQLabel *mDescription;
00109     TQLabel *mStatus;
00110 };
00111 
00112 #endif