signatureconfigurator.h
00001 /* -*- c++ -*- 00002 Copyright 2008 Thomas McGuire <Thomas.McGuire@gmx.net> 00003 Copyright 2008 Edwin Schepers <yez@familieschepers.nl> 00004 Copyright 2008 Tom Albers <tomalbers@kde.nl> 00005 Copyright 2004 Marc Mutz <mutz@kde.org> 00006 00007 This library is free software; you can redistribute it and/or 00008 modify it under the terms of the GNU Lesser General Public 00009 License as published by the Free Software Foundation; either 00010 version 2.1 of the License, or (at your option) any later version. 00011 00012 This library is distributed in the hope that it will be useful, 00013 but WITHOUT ANY WARRANTY; without even the implied warranty of 00014 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 00015 Lesser General Public License for more details. 00016 00017 You should have received a copy of the GNU Lesser General Public 00018 License along with this library. If not, see <http://www.gnu.org/licenses/>. 00019 */ 00020 00021 #ifndef KPIMIDENTITIES_SIGNATURECONFIGURATOR_H 00022 #define KPIMIDENTITIES_SIGNATURECONFIGURATOR_H 00023 00024 #include "kpimidentities_export.h" 00025 #include "signature.h" // for Signature::Type 00026 #include <QtGui/QWidget> 00027 00028 using KPIMIdentities::Signature; 00029 00030 class QCheckBox; 00031 class KComboBox; 00032 class KUrlRequester; 00033 class KLineEdit; 00034 class KToolBar; 00035 class KRichTextWidget; 00036 class QString; 00037 class QPushButton; 00038 class QTextEdit; 00039 class QTextCharFormat; 00040 00041 namespace KPIMIdentities { 00042 00048 class KPIMIDENTITIES_EXPORT SignatureConfigurator : public QWidget 00049 { 00050 Q_OBJECT 00051 public: 00055 explicit SignatureConfigurator( QWidget * parent = 0 ); 00056 00060 virtual ~SignatureConfigurator(); 00061 00065 enum ViewMode { ShowCode, ShowHtml }; 00066 00070 bool isSignatureEnabled() const; 00071 00075 void setSignatureEnabled( bool enable ); 00076 00081 Signature::Type signatureType() const; 00082 00086 void setSignatureType( Signature::Type type ); 00087 00092 QString inlineText() const; 00093 00097 void setInlineText( const QString & text ); 00098 00103 QString fileURL() const; 00104 00109 void setFileURL( const QString & url ); 00110 00115 QString commandURL() const; 00116 00120 void setCommandURL( const QString & url ); 00121 00126 Signature signature() const; 00127 00131 void setSignature( const Signature & sig ); 00132 00141 void setImageLocation( const QString &path ); 00142 00151 void setImageLocation( const Identity &identity ); 00152 00153 private: 00154 void toggleHtmlBtnState( ViewMode state ); 00155 00156 void initHtmlState(); 00157 00158 // Returns the current text of the textedit as HTML code, but strips 00159 // unnecessary tags Qt inserts 00160 QString asCleanedHTML() const; 00161 00162 protected Q_SLOTS: 00163 void slotEnableEditButton( const QString & ); 00164 void slotEdit(); 00165 void slotSetHtml(); 00166 00167 protected: 00168 00169 // TODO: KDE5: BIC: Move to private class! 00170 QCheckBox * mEnableCheck; 00171 QCheckBox * mHtmlCheck; 00172 KComboBox * mSourceCombo; 00173 KUrlRequester * mFileRequester; 00174 QPushButton * mEditButton; 00175 KLineEdit * mCommandEdit; 00176 KToolBar * mEditToolBar; 00177 KToolBar * mFormatToolBar; 00178 KRichTextWidget * mTextEdit; // Grmbl, why is this not in the private class? 00179 // This is a KPIMTextEdit::TextEdit, really. 00180 00181 private: 00182 //@cond PRIVATE 00183 class Private; 00184 Private *const d; 00185 //@endcond 00186 }; 00187 00188 } 00189 00190 #endif