00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
#ifndef IMEDITORWIDGET_H
00028
#define IMEDITORWIDGET_H
00029
00030
#include <qvaluelist.h>
00031
#include <klistview.h>
00032
00033
#include "contacteditorwidget.h"
00034
#include "imeditorbase.h"
00035
00036
class AddressWidget;
00037
class KPluginInfo;
00038
00039
enum IMContext { Any, Home, Work };
00040
00041
00042
00043
00044
00045
00049 class IMEditorWidget :
public KAB::ContactEditorWidget
00050 {
00051 Q_OBJECT
00052
00053
public:
00054
IMEditorWidget( KABC::AddressBook *ab,
QWidget *parent,
const char *name = 0 );
00055 ~
IMEditorWidget() {};
00056
00060
void loadContact( KABC::Addressee *addr );
00061
void storeContact( KABC::Addressee *addr );
00062
void setReadOnly(
bool readOnly );
00063
QValueList<KPluginInfo *> availableProtocols()
const;
00064
protected slots:
00065
void slotUpdateButtons();
00066
void slotAdd();
00067
void slotEdit();
00068
void slotDelete();
00069
protected:
00073
static void splitField(
const QString &str,
QString &app,
QString &name,
QString &value );
00077 KPluginInfo *
protocolFromString(
const QString fieldValue );
00078
private:
00079
bool mReadOnly;
00080 IMEditorBase *mWidget;
00081
00082
QValueList<KPluginInfo *> mChangedProtocols;
00083
QValueList<KPluginInfo *> mProtocols;
00084 };
00085
00090
00091 class IMAddressLVI :
public KListViewItem
00092 {
00093
public:
00094
IMAddressLVI( KListView *parent, KPluginInfo * protocol,
QString address, IMContext context = Any );
00095
void setAddress(
const QString &address );
00096
void setProtocol( KPluginInfo * protocol );
00097
void setContext( IMContext context );
00098
void activate();
00099 KPluginInfo * protocol()
const;
00100
QString address()
const;
00101 IMContext context()
const;
00102
private:
00103 KPluginInfo * mProtocol;
00104 IMContext mContext;
00105
00106 };
00107
00111 class IMEditorWidgetFactory :
public KAB::ContactEditorWidgetFactory
00112 {
00113
public:
00114
IMEditorWidgetFactory() {};
00115 KAB::ContactEditorWidget *createWidget( KABC::AddressBook *ab,
QWidget *parent,
const char *name )
00116 {
00117
return new IMEditorWidget( ab, parent, name );
00118 }
00119
00120
QString pageTitle()
const;
00121
QString pageIdentifier()
const;
00122 };
00123
00124
00125
#endif