kitchensync

groupitem.h
1 /*
2  This file is part of KitchenSync.
3 
4  Copyright (c) 2005 Tobias Koenig <tokoe@kde.org>
5 
6  This program is free software; you can redistribute it and/or modify
7  it under the terms of the GNU General Public License as published by
8  the Free Software Foundation; either version 2 of the License, or
9  (at your option) any later version.
10 
11  This program is distributed in the hope that it will be useful,
12  but WITHOUT ANY WARRANTY; without even the implied warranty of
13  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14  GNU General Public License for more details.
15 
16  You should have received a copy of the GNU General Public License
17  along with this program; if not, write to the Free Software
18  Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
19 */
20 
21 #ifndef GROUPITEM_H
22 #define GROUPITEM_H
23 
24 #include "syncprocess.h"
25 
26 #include <libqopensync/callbackhandler.h>
27 
28 #include <kwidgetlist.h>
29 
30 namespace QSync {
31 class Engine;
32 }
33 
34 class MemberItem;
35 class KURLLabel;
36 class TQLabel;
37 class TQProgressBar;
38 class TQVBox;
39 
40 class GroupItem : public KWidgetListItem
41 {
42  Q_OBJECT
43 
44 
45  public:
46  GroupItem( KWidgetList*, SyncProcess *syncProcess );
47  ~GroupItem();
48 
49  SyncProcess *syncProcess() const { return mSyncProcess; }
50 
51  void update();
52 
53  void clear();
54 
55  signals:
56  void synchronizeGroup( SyncProcess *syncProcess );
57  void abortSynchronizeGroup( SyncProcess *syncProcess );
58  void configureGroup( SyncProcess *syncProcess );
59 
60  protected slots:
61  void conflict( QSync::SyncMapping );
62  void change( const QSync::SyncChangeUpdate& );
63  void mapping( const QSync::SyncMappingUpdate& );
64  void engine( const QSync::SyncEngineUpdate& );
65  void member( const QSync::SyncMemberUpdate& );
66 
67  void synchronize();
68  void configure();
69 
70  void engineChanged( QSync::Engine *engine );
71 
72  private:
73  SyncProcess *mSyncProcess;
74  QSync::CallbackHandler *mCallbackHandler;
75  TQValueList<MemberItem*> mMemberItems;
76 
77  TQLabel *mIcon;
78  TQLabel *mGroupName;
79  TQLabel *mStatus;
80  TQLabel *mTime;
81  KURLLabel *mSyncAction;
82  KURLLabel *mConfigureAction;
83  TQVBox *mBox;
84  TQProgressBar *mProgressBar;
85 
86  int mProcessedItems;
87  int mMaxProcessedItems;
88  bool mSynchronizing;
89 };
90 
91 class MemberItem : public TQWidget
92 {
93  public:
94  MemberItem( TQWidget *parent, SyncProcess *syncProcess,
95  const QSync::Member &member );
96 
97  SyncProcess* syncProcess() const { return mSyncProcess; }
98  QSync::Member member() const { return mMember; }
99 
100  void setStatusMessage( const TQString &msg );
101 
102  private:
103  SyncProcess *mSyncProcess;
104  QSync::Member mMember;
105 
106  TQLabel *mIcon;
107  TQLabel *mMemberName;
108  TQLabel *mDescription;
109  TQLabel *mStatus;
110 };
111 
112 #endif