libkdepim

kincidencechooser.h

00001 /*
00002   This file is part of libkdepim.
00003 
00004   Copyright (c) 2004 Lutz Rogowski <rogowski@kde.org>
00005   Copyright (c) 2010 Klarälvdalens Datakonsult AB, a KDAB Group company <info@kdab.net>
00006 
00007   This program is free software; you can redistribute it and/or modify
00008   it under the terms of the GNU General Public License as published by
00009   the Free Software Foundation; either version 2 of the License, or
00010   (at your option) any later version.
00011 
00012   This program is distributed in the hope that it will be useful,
00013   but WITHOUT ANY WARRANTY; without even the implied warranty of
00014   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
00015   GNU General Public License for more details.
00016 
00017   You should have received a copy of the GNU General Public License
00018   along with this program; if not, write to the Free Software
00019   Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
00020 
00021   As a special exception, permission is given to link this program
00022   with any edition of Qt, and distribute the resulting executable,
00023   without including the source code for Qt in the source distribution.
00024 */
00025 #ifndef KPIM_KINCIDENCECHOOSER_H
00026 #define KPIM_KINCIDENCECHOOSER_H
00027 
00028 #include <kdialogbase.h>
00029 
00030 namespace KCal {
00031   class Incidence;
00032 }
00033 
00034 class QButtonGroup;
00035 class QGridLayout;
00036 class QRadioButton;
00037 
00038 namespace KPIM {
00039 
00043 class KDE_EXPORT KIncidenceChooser : public KDialog
00044 {
00045   Q_OBJECT
00046   public:
00047     enum TakeMode {
00048       Newer=0,  
00049       Remote,   
00050       Local,    
00051       Both      
00052     };
00053 
00054     enum ConflictAskPolicy {
00055       Always=0,  
00056       Sync,      
00057       Session,   
00058       Never      
00059     };
00060 
00062     explicit KIncidenceChooser( const QString &folder,
00063                                 ConflictAskPolicy askPolicy=Always,
00064                                 bool FolderOnly=true,
00065                                 QWidget *parent=0, char *name=0 );
00066     ~KIncidenceChooser();
00067     void setIncidences( KCal::Incidence *, KCal::Incidence  * );
00068 
00069     KCal::Incidence *takeIncidence();
00070     TakeMode takeMode();
00071 
00072     void setConflictAskPolicy( ConflictAskPolicy policy );
00073     ConflictAskPolicy conflictAskPolicy();
00074 
00075     void setFolderOnly( bool folderOnly );
00076     bool folderOnly();
00077 
00078   public slots:
00079     void useGlobalMode();
00080 
00081   protected slots:
00082     void showLocalIncidence();
00083     void showRemoteIncidence();
00084     void takeNewerIncidence();
00085     void takeRemoteIncidence();
00086     void takeLocalIncidence();
00087     void takeBothIncidence();
00088     void setLabels();
00089     void detailsDialogClosed();
00090     void slotFolderAll();
00091     void slotFolderOnly();
00092 
00093   protected:
00094     void keyPressEvent( QKeyEvent *e );
00095     void closeEvent( QCloseEvent *e );
00096 
00097   private:
00098     QString summaryStr( KCal::Incidence *incidence ) const;
00099     QString modifiedStr( KCal::Incidence *incidence ) const;
00100     QString mFolder;
00101     KCal::Incidence *mLocInc, *mRemInc, *mSelIncidence;
00102     QButtonGroup *mBg;
00103     QPushButton *mLocShowDetails, *mRemShowDetails;
00104     QLabel *mLocEntryVal, *mLocModVal;
00105     QLabel *mRemEntryVal, *mRemModVal;
00106     KDialogBase *mTbL, *mTbN;
00107     QRadioButton *mFolderAllBut, *mFolderOnlyBut;
00108     ConflictAskPolicy mAskPolicy;
00109     bool mFolderOnly;
00110     TakeMode mTakeMode;
00111 };
00112 
00113 }
00114 
00115 #endif
KDE Home | KDE Accessibility Home | Description of Access Keys