kaddressbook
imeditorwidget.h00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025 #ifndef IMEDITORWIDGET_H
00026 #define IMEDITORWIDGET_H
00027
00028 #include <tqvaluelist.h>
00029 #include <klistview.h>
00030 #include <kdialogbase.h>
00031
00032 #include "contacteditorwidget.h"
00033
00034
00035 class AddressWidget;
00036 class KPluginInfo;
00037 class IMEditorBase;
00038
00039 enum IMContext { Any, Home, Work };
00040
00041
00042
00043
00044
00045
00049 class IMEditorWidget : public KDialogBase
00050 {
00051 Q_OBJECT
00052
00053 public:
00054 IMEditorWidget( TQWidget *parent, const TQString &preferredIM, const char *name = 0 );
00055 ~IMEditorWidget() {};
00056
00057 void loadContact( KABC::Addressee *addr );
00058 void storeContact( KABC::Addressee *addr );
00059 void setReadOnly( bool readOnly );
00060 TQValueList<KPluginInfo *> availableProtocols() const;
00061 bool isModified() const;
00062 TQString preferred() const;
00063
00064 protected slots:
00065 void slotUpdateButtons();
00066 void slotAdd();
00067 void slotEdit();
00068 void slotDelete();
00069 void slotSetStandard();
00070
00071 protected:
00075 static void splitField( const TQString &str, TQString &app, TQString &name, TQString &value );
00076
00080 KPluginInfo * protocolFromString( const TQString &fieldValue ) const;
00081
00082 private:
00083 bool mReadOnly;
00084 bool mModified;
00085 TQString mPreferred;
00086 IMEditorBase *mWidget;
00087 void setModified( bool modified );
00088
00089
00090 TQValueList<KPluginInfo *> mChangedProtocols;
00091 TQValueList<KPluginInfo *> mProtocols;
00092 };
00093
00098
00099 class IMAddressLVI : public KListViewItem
00100 {
00101 public:
00102 IMAddressLVI( KListView *parent, KPluginInfo * protocol,
00103 const TQString &address, const IMContext &context = Any );
00104
00105 void setAddress( const TQString &address );
00106 void setProtocol( KPluginInfo * protocol );
00107 void setContext( const IMContext &context );
00108 void activate();
00109
00110 KPluginInfo * protocol() const;
00111 TQString address() const;
00112 IMContext context() const;
00113
00114 void setPreferred( bool preferred );
00115 bool preferred() const;
00116
00117 protected:
00118 virtual void paintCell( TQPainter *p, const TQColorGroup &cg, int column, int width, int alignment );
00119
00120 private:
00121 KPluginInfo * mProtocol;
00122 bool mPreferred;
00123 IMContext mContext;
00124 TQString mAddress;
00125 };
00126
00127 #endif
00128
|