kitchensync

configgui.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 CONFIGGUI_H
00022 #define CONFIGGUI_H
00023 
00024 #include <libqopensync/member.h>
00025 
00026 #include <qwidget.h>
00027 
00028 class QBoxLayout;
00029 class KLineEdit;
00030 class QTextEdit;
00031 
00032 class ConfigGui : public QWidget
00033 {
00034   public:
00035     ConfigGui( const QSync::Member &, QWidget *parent );
00036 
00037     class Factory
00038     {
00039       public:
00040         static ConfigGui *create( const QSync::Member &, QWidget *parent );
00041     };
00042 
00043     void setInstanceName( const QString & );
00044     QString instanceName() const;
00045 
00046     virtual void load( const QString &xml ) = 0;
00047     virtual QString save() const = 0;
00048 
00049     QSync::Member member() const { return mMember; }
00050 
00051     QBoxLayout *topLayout() const { return mTopLayout; }
00052 
00053   private:
00054     QSync::Member mMember;
00055 
00056     QBoxLayout *mTopLayout;
00057     KLineEdit *mNameEdit;
00058 };
00059 
00060 class ConfigGuiXml : public ConfigGui
00061 {
00062   public:
00063     ConfigGuiXml( const QSync::Member &, QWidget *parent );
00064 
00065     void load( const QString & );
00066     QString save() const;
00067 
00068   private:
00069     QTextEdit *mTextEdit;
00070 };
00071 
00072 #endif