kitchensync

pluginpicker.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 PLUGINPICKER_H
00022 #define PLUGINPICKER_H
00023 
00024 #include <libqopensync/plugin.h>
00025 
00026 #include <kdialogbase.h>
00027 #include <kwidgetlist.h>
00028 
00029 #include <qwidget.h>
00030 
00031 class PluginItem : public KWidgetListItem
00032 {
00033   public:
00034    PluginItem( KWidgetList *, const QSync::Plugin & );
00035 
00036    QSync::Plugin plugin() const { return mPlugin; }
00037 
00038   private:
00039     QSync::Plugin mPlugin;
00040 };
00041 
00042 class PluginPicker : public QWidget
00043 {
00044   Q_OBJECT
00045 
00046   public:
00047     PluginPicker( QWidget *parent );
00048 
00049     QSync::Plugin selectedPlugin() const;
00050 
00051   signals:
00052     void selected();
00053 
00054   protected:
00055     void updatePluginList();
00056 
00057   private:
00058     KWidgetList *mPluginList;
00059 };
00060 
00061 class PluginPickerDialog : public KDialogBase
00062 {
00063   Q_OBJECT
00064 
00065   public:
00066     PluginPickerDialog( QWidget *parent );
00067 
00068     QSync::Plugin selectedPlugin() const;
00069 
00070     static QSync::Plugin getPlugin( QWidget *parent );
00071 
00072   protected slots:
00073     void slotOk();
00074     void slotCancel();
00075 
00076   private:
00077     PluginPicker *mPicker;
00078 };
00079 
00080 #endif