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 TQ_OBJECT
00053
00054 public:
00055 IMEditorWidget( TQWidget *parent, const TQString &preferredIM, const char *name = 0 );
00056 ~IMEditorWidget() {};
00057
00058 void loadContact( KABC::Addressee *addr );
00059 void storeContact( KABC::Addressee *addr );
00060 void setReadOnly( bool readOnly );
00061 TQValueList<KPluginInfo *> availableProtocols() const;
00062 bool isModified() const;
00063 TQString preferred() const;
00064
00065 protected slots:
00066 void slotUpdateButtons();
00067 void slotAdd();
00068 void slotEdit();
00069 void slotDelete();
00070 void slotSetStandard();
00071
00072 protected:
00076 static void splitField( const TQString &str, TQString &app, TQString &name, TQString &value );
00077
00081 KPluginInfo * protocolFromString( const TQString &fieldValue ) const;
00082
00083 private:
00084 bool mReadOnly;
00085 bool mModified;
00086 TQString mPreferred;
00087 IMEditorBase *mWidget;
00088 void setModified( bool modified );
00089
00090
00091 TQValueList<KPluginInfo *> mChangedProtocols;
00092 TQValueList<KPluginInfo *> mProtocols;
00093 };
00094
00099
00100 class IMAddressLVI : public KListViewItem
00101 {
00102 public:
00103 IMAddressLVI( KListView *parent, KPluginInfo * protocol,
00104 const TQString &address, const IMContext &context = Any );
00105
00106 void setAddress( const TQString &address );
00107 void setProtocol( KPluginInfo * protocol );
00108 void setContext( const IMContext &context );
00109 void activate();
00110
00111 KPluginInfo * protocol() const;
00112 TQString address() const;
00113 IMContext context() const;
00114
00115 void setPreferred( bool preferred );
00116 bool preferred() const;
00117
00118 protected:
00119 virtual void paintCell( TQPainter *p, const TQColorGroup &cg, int column, int width, int alignment );
00120
00121 private:
00122 KPluginInfo * mProtocol;
00123 bool mPreferred;
00124 IMContext mContext;
00125 TQString mAddress;
00126 };
00127
00128 #endif
00129
|