<?xml version="1.0" encoding="UTF-8"?> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml" lang="en_US" xml:lang="en_US"> <head> <title>kmail: signatureconfigurator.cpp Source File (kmail)</title> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <meta http-equiv="Content-Style-Type" content="text/css" /> <meta http-equiv="pics-label" content='(pics-1.1 "http://www.icra.org/ratingsv02.html" comment "ICRAonline DE v2.0" l gen true for "http://www.kde.org" r (nz 1 vz 1 lz 1 oz 1 cb 1) "http://www.rsac.org/ratingsv01.html" l gen true for "http://www.kde.org" r (n 0 s 0 v 0 l 0))' /> <meta name="trademark" content="KDE e.V." /> <meta name="description" content="K Desktop Environment Homepage, KDE.org" /> <meta name="MSSmartTagsPreventParsing" content="true" /> <meta name="robots" content="all" /> <link rel="shortcut icon" href="../../favicon.ico" /> <link rel="stylesheet" media="screen" type="text/css" title="APIDOX" href="doxygen.css" /> <style type="text/css"> <!-- hr { display: none; } #content h2 { margin-left: 0px; } table.mdTable { background-color: #f8f8f8; border: .2em solid #d7d7d7; } td.mdRow { padding: 8px 20px; } td.md { font-weight: bold; } td.mdname1 { font-weight: bold; color: #602020; } td.mdname { font-weight: bold; color: #602020; } --> </style> </head> <body> <div id="nav_header_top" align="right"> <a href="#content" class="doNotDisplay" accesskey="2">Skip to main content ::</a> <a href="../.."><img id="nav_header_logo" alt="Home" align="left" src="../../kde_gear_64.png" border="0" /></a> <span class="doNotDisplay">::</span> <img id="nav_header_logo_right" alt="" align="right" src="../../pimlogo.png" border="0" /> <div id="nav_header_title" align="left">KDE PIM API Reference</div> </div> <div id="nav_header_bottom" align="right"> <span class="doNotDisplay">:: <a href="#navigation" accesskey="5">Skip to Link Menu</a><br/></span> <div id="nav_header_bottom_left" style="text-align: left;"> / <a href="../../">API Reference</a> / <a href=".">kmail</a> </div> </div> <table id="main" border="0" cellpadding="0" cellspacing="0" width="100%"> <tr> <td valign="top" class="menuheader" height="0"></td> <td id="contentcolumn" valign="top" rowspan="2" > <div id="content" style="padding-top: 0px;"><div style="width:100%; margin: 0px; padding: 0px;"> <h2><a name="content"></a>kmail</h2> <!-- Generated by Doxygen 1.5.5 --> <h1>signatureconfigurator.cpp</h1><div class="fragment"><pre class="fragment"><a name="l00001"></a>00001 <span class="comment">/* -*- c++ -*-</span> <a name="l00002"></a>00002 <span class="comment"> signatureconfigurator.cpp</span> <a name="l00003"></a>00003 <span class="comment"></span> <a name="l00004"></a>00004 <span class="comment"> KMail, the KDE mail client.</span> <a name="l00005"></a>00005 <span class="comment"> Copyright (c) 2002 the KMail authors.</span> <a name="l00006"></a>00006 <span class="comment"> See file AUTHORS for details</span> <a name="l00007"></a>00007 <span class="comment"></span> <a name="l00008"></a>00008 <span class="comment"> This program is free software; you can redistribute it and/or</span> <a name="l00009"></a>00009 <span class="comment"> modify it under the terms of the GNU General Public License,</span> <a name="l00010"></a>00010 <span class="comment"> version 2.0, as published by the Free Software Foundation.</span> <a name="l00011"></a>00011 <span class="comment"> You should have received a copy of the GNU General Public License</span> <a name="l00012"></a>00012 <span class="comment"> along with this program; if not, write to the Free Software Foundation,</span> <a name="l00013"></a>00013 <span class="comment"> Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, US</span> <a name="l00014"></a>00014 <span class="comment">*/</span> <a name="l00015"></a>00015 <a name="l00016"></a>00016 <span class="preprocessor">#ifdef HAVE_CONFIG_H</span> <a name="l00017"></a>00017 <span class="preprocessor"></span><span class="preprocessor">#include <config.h></span> <a name="l00018"></a>00018 <span class="preprocessor">#endif</span> <a name="l00019"></a>00019 <span class="preprocessor"></span> <a name="l00020"></a>00020 <span class="preprocessor">#include "signatureconfigurator.h"</span> <a name="l00021"></a>00021 <a name="l00022"></a>00022 <span class="preprocessor">#include <klocale.h></span> <a name="l00023"></a>00023 <span class="preprocessor">#include <kdialog.h></span> <a name="l00024"></a>00024 <span class="preprocessor">#include <klineedit.h></span> <a name="l00025"></a>00025 <span class="preprocessor">#include <kurlrequester.h></span> <a name="l00026"></a>00026 <span class="preprocessor">#include <kshellcompletion.h></span> <a name="l00027"></a>00027 <span class="preprocessor">#include <krun.h></span> <a name="l00028"></a>00028 <a name="l00029"></a>00029 <span class="preprocessor">#include <qcheckbox.h></span> <a name="l00030"></a>00030 <span class="preprocessor">#include <qcombobox.h></span> <a name="l00031"></a>00031 <span class="preprocessor">#include <qdir.h></span> <a name="l00032"></a>00032 <span class="preprocessor">#include <qfileinfo.h></span> <a name="l00033"></a>00033 <span class="preprocessor">#include <qlabel.h></span> <a name="l00034"></a>00034 <span class="preprocessor">#include <qlayout.h></span> <a name="l00035"></a>00035 <span class="preprocessor">#include <qtextedit.h></span> <a name="l00036"></a>00036 <span class="preprocessor">#include <qwhatsthis.h></span> <a name="l00037"></a>00037 <span class="preprocessor">#include <qwidgetstack.h></span> <a name="l00038"></a>00038 <a name="l00039"></a>00039 <span class="preprocessor">#include <assert.h></span> <a name="l00040"></a>00040 <a name="l00041"></a>00041 <span class="keyword">using namespace </span>KMail; <a name="l00042"></a>00042 <a name="l00043"></a>00043 <span class="keyword">namespace </span>KMail { <a name="l00044"></a>00044 <a name="l00045"></a>00045 SignatureConfigurator::SignatureConfigurator( QWidget * parent, <span class="keyword">const</span> <span class="keywordtype">char</span> * name ) <a name="l00046"></a>00046 : QWidget( parent, name ) <a name="l00047"></a>00047 { <a name="l00048"></a>00048 <span class="comment">// tmp. vars:</span> <a name="l00049"></a>00049 QLabel * label; <a name="l00050"></a>00050 QWidget * page; <a name="l00051"></a>00051 QHBoxLayout * hlay; <a name="l00052"></a>00052 QVBoxLayout * vlay; <a name="l00053"></a>00053 QVBoxLayout * page_vlay; <a name="l00054"></a>00054 <a name="l00055"></a>00055 vlay = <span class="keyword">new</span> QVBoxLayout( <span class="keyword">this</span>, 0, KDialog::spacingHint(), <span class="stringliteral">"main layout"</span> ); <a name="l00056"></a>00056 <a name="l00057"></a>00057 <span class="comment">// "enable signatue" checkbox:</span> <a name="l00058"></a>00058 mEnableCheck = <span class="keyword">new</span> QCheckBox( i18n(<span class="stringliteral">"&Enable signature"</span>), <span class="keyword">this</span> ); <a name="l00059"></a>00059 QWhatsThis::add(mEnableCheck, <a name="l00060"></a>00060 i18n(<span class="stringliteral">"Check this box if you want KMail to append a signature to mails "</span> <a name="l00061"></a>00061 <span class="stringliteral">"written with this identity."</span>)); <a name="l00062"></a>00062 vlay->addWidget( mEnableCheck ); <a name="l00063"></a>00063 <a name="l00064"></a>00064 <span class="comment">// "obtain signature text from" combo and label:</span> <a name="l00065"></a>00065 hlay = <span class="keyword">new</span> QHBoxLayout( vlay ); <span class="comment">// inherits spacing</span> <a name="l00066"></a>00066 mSourceCombo = <span class="keyword">new</span> QComboBox( <span class="keyword">false</span>, <span class="keyword">this</span> ); <a name="l00067"></a>00067 QWhatsThis::add(mSourceCombo, <a name="l00068"></a>00068 i18n(<span class="stringliteral">"Click on the widgets below to obtain help on the input methods."</span>)); <a name="l00069"></a>00069 mSourceCombo->setEnabled( <span class="keyword">false</span> ); <span class="comment">// since !mEnableCheck->isChecked()</span> <a name="l00070"></a>00070 mSourceCombo->insertStringList( QStringList() <a name="l00071"></a>00071 << i18n(<span class="stringliteral">"continuation of \"obtain signature text from\""</span>, <a name="l00072"></a>00072 <span class="stringliteral">"Input Field Below"</span>) <a name="l00073"></a>00073 << i18n(<span class="stringliteral">"continuation of \"obtain signature text from\""</span>, <a name="l00074"></a>00074 <span class="stringliteral">"File"</span>) <a name="l00075"></a>00075 << i18n(<span class="stringliteral">"continuation of \"obtain signature text from\""</span>, <a name="l00076"></a>00076 <span class="stringliteral">"Output of Command"</span>) <a name="l00077"></a>00077 ); <a name="l00078"></a>00078 label = <span class="keyword">new</span> QLabel( mSourceCombo, <a name="l00079"></a>00079 i18n(<span class="stringliteral">"Obtain signature &text from:"</span>), <span class="keyword">this</span> ); <a name="l00080"></a>00080 label->setEnabled( <span class="keyword">false</span> ); <span class="comment">// since !mEnableCheck->isChecked()</span> <a name="l00081"></a>00081 hlay->addWidget( label ); <a name="l00082"></a>00082 hlay->addWidget( mSourceCombo, 1 ); <a name="l00083"></a>00083 <a name="l00084"></a>00084 <span class="comment">// widget stack that is controlled by the source combo:</span> <a name="l00085"></a>00085 QWidgetStack * widgetStack = <span class="keyword">new</span> QWidgetStack( <span class="keyword">this</span> ); <a name="l00086"></a>00086 widgetStack->setEnabled( <span class="keyword">false</span> ); <span class="comment">// since !mEnableCheck->isChecked()</span> <a name="l00087"></a>00087 vlay->addWidget( widgetStack, 1 ); <a name="l00088"></a>00088 connect( mSourceCombo, SIGNAL(highlighted(<span class="keywordtype">int</span>)), <a name="l00089"></a>00089 widgetStack, SLOT(raiseWidget(<span class="keywordtype">int</span>)) ); <a name="l00090"></a>00090 <span class="comment">// connects for the enabling of the widgets depending on</span> <a name="l00091"></a>00091 <span class="comment">// signatureEnabled:</span> <a name="l00092"></a>00092 connect( mEnableCheck, SIGNAL(toggled(<span class="keywordtype">bool</span>)), <a name="l00093"></a>00093 mSourceCombo, SLOT(setEnabled(<span class="keywordtype">bool</span>)) ); <a name="l00094"></a>00094 connect( mEnableCheck, SIGNAL(toggled(<span class="keywordtype">bool</span>)), <a name="l00095"></a>00095 widgetStack, SLOT(setEnabled(<span class="keywordtype">bool</span>)) ); <a name="l00096"></a>00096 connect( mEnableCheck, SIGNAL(toggled(<span class="keywordtype">bool</span>)), <a name="l00097"></a>00097 label, SLOT(setEnabled(<span class="keywordtype">bool</span>)) ); <a name="l00098"></a>00098 <span class="comment">// The focus might be still in the widget that is disabled</span> <a name="l00099"></a>00099 connect( mEnableCheck, SIGNAL(clicked()), <a name="l00100"></a>00100 mEnableCheck, SLOT(setFocus()) ); <a name="l00101"></a>00101 <a name="l00102"></a>00102 <span class="keywordtype">int</span> pageno = 0; <a name="l00103"></a>00103 <span class="comment">// page 0: input field for direct entering:</span> <a name="l00104"></a>00104 mTextEdit = <span class="keyword">new</span> QTextEdit( widgetStack ); <a name="l00105"></a>00105 QWhatsThis::add(mTextEdit, <a name="l00106"></a>00106 i18n(<span class="stringliteral">"Use this field to enter an arbitrary static signature."</span>)); <a name="l00107"></a>00107 widgetStack->addWidget( mTextEdit, pageno ); <a name="l00108"></a>00108 mTextEdit->setFont( KGlobalSettings::fixedFont() ); <a name="l00109"></a>00109 mTextEdit->setWordWrap( QTextEdit::NoWrap ); <a name="l00110"></a>00110 mTextEdit->setTextFormat( Qt::PlainText ); <a name="l00111"></a>00111 <a name="l00112"></a>00112 widgetStack->raiseWidget( 0 ); <span class="comment">// since mSourceCombo->currentItem() == 0</span> <a name="l00113"></a>00113 <a name="l00114"></a>00114 <span class="comment">// page 1: "signature file" requester, label, "edit file" button:</span> <a name="l00115"></a>00115 ++pageno; <a name="l00116"></a>00116 page = <span class="keyword">new</span> QWidget( widgetStack ); <a name="l00117"></a>00117 widgetStack->addWidget( page, pageno ); <span class="comment">// force sequential numbers (play safe)</span> <a name="l00118"></a>00118 page_vlay = <span class="keyword">new</span> QVBoxLayout( page, 0, KDialog::spacingHint() ); <a name="l00119"></a>00119 hlay = <span class="keyword">new</span> QHBoxLayout( page_vlay ); <span class="comment">// inherits spacing</span> <a name="l00120"></a>00120 mFileRequester = <span class="keyword">new</span> KURLRequester( page ); <a name="l00121"></a>00121 QWhatsThis::add(mFileRequester, <a name="l00122"></a>00122 i18n(<span class="stringliteral">"Use this requester to specify a text file that contains your "</span> <a name="l00123"></a>00123 <span class="stringliteral">"signature. It will be read every time you create a new mail or "</span> <a name="l00124"></a>00124 <span class="stringliteral">"append a new signature."</span>)); <a name="l00125"></a>00125 hlay->addWidget( <span class="keyword">new</span> QLabel( mFileRequester, <a name="l00126"></a>00126 i18n(<span class="stringliteral">"S&pecify file:"</span>), page ) ); <a name="l00127"></a>00127 hlay->addWidget( mFileRequester, 1 ); <a name="l00128"></a>00128 mFileRequester->button()->setAutoDefault( <span class="keyword">false</span> ); <a name="l00129"></a>00129 connect( mFileRequester, SIGNAL(textChanged(<span class="keyword">const</span> QString &)), <a name="l00130"></a>00130 <span class="keyword">this</span>, SLOT(slotEnableEditButton(<span class="keyword">const</span> QString &)) ); <a name="l00131"></a>00131 mEditButton = <span class="keyword">new</span> QPushButton( i18n(<span class="stringliteral">"Edit &File"</span>), page ); <a name="l00132"></a>00132 QWhatsThis::add(mEditButton, i18n(<span class="stringliteral">"Opens the specified file in a text editor."</span>)); <a name="l00133"></a>00133 connect( mEditButton, SIGNAL(clicked()), SLOT(slotEdit()) ); <a name="l00134"></a>00134 mEditButton->setAutoDefault( <span class="keyword">false</span> ); <a name="l00135"></a>00135 mEditButton->setEnabled( <span class="keyword">false</span> ); <span class="comment">// initially nothing to edit</span> <a name="l00136"></a>00136 hlay->addWidget( mEditButton ); <a name="l00137"></a>00137 page_vlay->addStretch( 1 ); <span class="comment">// spacer</span> <a name="l00138"></a>00138 <a name="l00139"></a>00139 <span class="comment">// page 2: "signature command" requester and label:</span> <a name="l00140"></a>00140 ++pageno; <a name="l00141"></a>00141 page = <span class="keyword">new</span> QWidget( widgetStack ); <a name="l00142"></a>00142 widgetStack->addWidget( page, pageno ); <a name="l00143"></a>00143 page_vlay = <span class="keyword">new</span> QVBoxLayout( page, 0, KDialog::spacingHint() ); <a name="l00144"></a>00144 hlay = <span class="keyword">new</span> QHBoxLayout( page_vlay ); <span class="comment">// inherits spacing</span> <a name="l00145"></a>00145 mCommandEdit = <span class="keyword">new</span> KLineEdit( page ); <a name="l00146"></a>00146 mCommandEdit->setCompletionObject( <span class="keyword">new</span> KShellCompletion() ); <a name="l00147"></a>00147 mCommandEdit->setAutoDeleteCompletionObject( <span class="keyword">true</span> ); <a name="l00148"></a>00148 QWhatsThis::add(mCommandEdit, <a name="l00149"></a>00149 i18n(<span class="stringliteral">"You can add an arbitrary command here, either with or without path "</span> <a name="l00150"></a>00150 <span class="stringliteral">"depending on whether or not the command is in your Path. For every "</span> <a name="l00151"></a>00151 <span class="stringliteral">"new mail, KMail will execute the command and use what it outputs (to "</span> <a name="l00152"></a>00152 <span class="stringliteral">"standard output) as a signature. Usual commands for use with this "</span> <a name="l00153"></a>00153 <span class="stringliteral">"mechanism are \"fortune\" or \"ksig -random\"."</span>)); <a name="l00154"></a>00154 hlay->addWidget( <span class="keyword">new</span> QLabel( mCommandEdit, <a name="l00155"></a>00155 i18n(<span class="stringliteral">"S&pecify command:"</span>), page ) ); <a name="l00156"></a>00156 hlay->addWidget( mCommandEdit, 1 ); <a name="l00157"></a>00157 page_vlay->addStretch( 1 ); <span class="comment">// spacer</span> <a name="l00158"></a>00158 <a name="l00159"></a>00159 } <a name="l00160"></a>00160 <a name="l00161"></a>00161 SignatureConfigurator::~SignatureConfigurator() { <a name="l00162"></a>00162 <a name="l00163"></a>00163 } <a name="l00164"></a>00164 <a name="l00165"></a>00165 <span class="keywordtype">bool</span> SignatureConfigurator::isSignatureEnabled()<span class="keyword"> const </span>{ <a name="l00166"></a>00166 <span class="keywordflow">return</span> mEnableCheck->isChecked(); <a name="l00167"></a>00167 } <a name="l00168"></a>00168 <a name="l00169"></a>00169 <span class="keywordtype">void</span> SignatureConfigurator::setSignatureEnabled( <span class="keywordtype">bool</span> enable ) { <a name="l00170"></a>00170 mEnableCheck->setChecked( enable ); <a name="l00171"></a>00171 } <a name="l00172"></a>00172 <a name="l00173"></a>00173 Signature::Type SignatureConfigurator::signatureType()<span class="keyword"> const </span>{ <a name="l00174"></a>00174 <span class="keywordflow">if</span> ( !isSignatureEnabled() ) <span class="keywordflow">return</span> Signature::Disabled; <a name="l00175"></a>00175 <a name="l00176"></a>00176 <span class="keywordflow">switch</span> ( mSourceCombo->currentItem() ) { <a name="l00177"></a>00177 <span class="keywordflow">case</span> 0: <span class="keywordflow">return</span> Signature::Inlined; <a name="l00178"></a>00178 <span class="keywordflow">case</span> 1: <span class="keywordflow">return</span> Signature::FromFile; <a name="l00179"></a>00179 <span class="keywordflow">case</span> 2: <span class="keywordflow">return</span> Signature::FromCommand; <a name="l00180"></a>00180 <span class="keywordflow">default</span>: <span class="keywordflow">return</span> Signature::Disabled; <a name="l00181"></a>00181 } <a name="l00182"></a>00182 } <a name="l00183"></a>00183 <a name="l00184"></a>00184 <span class="keywordtype">void</span> SignatureConfigurator::setSignatureType( Signature::Type type ) { <a name="l00185"></a>00185 setSignatureEnabled( type != Signature::Disabled ); <a name="l00186"></a>00186 <a name="l00187"></a>00187 <span class="keywordtype">int</span> idx = 0; <a name="l00188"></a>00188 <span class="keywordflow">switch</span>( type ) { <a name="l00189"></a>00189 <span class="keywordflow">case</span> Signature::Inlined: idx = 0; <span class="keywordflow">break</span>; <a name="l00190"></a>00190 <span class="keywordflow">case</span> Signature::FromFile: idx = 1; <span class="keywordflow">break</span>; <a name="l00191"></a>00191 <span class="keywordflow">case</span> Signature::FromCommand: idx = 2; <span class="keywordflow">break</span>; <a name="l00192"></a>00192 <span class="keywordflow">default</span>: idx = 0; <span class="keywordflow">break</span>; <a name="l00193"></a>00193 }; <a name="l00194"></a>00194 <a name="l00195"></a>00195 mSourceCombo->setCurrentItem( idx ); <a name="l00196"></a>00196 } <a name="l00197"></a>00197 <a name="l00198"></a>00198 QString SignatureConfigurator::inlineText()<span class="keyword"> const </span>{ <a name="l00199"></a>00199 <span class="keywordflow">return</span> mTextEdit->text(); <a name="l00200"></a>00200 } <a name="l00201"></a>00201 <a name="l00202"></a>00202 <span class="keywordtype">void</span> SignatureConfigurator::setInlineText( <span class="keyword">const</span> QString & text ) { <a name="l00203"></a>00203 mTextEdit->setText( text ); <a name="l00204"></a>00204 } <a name="l00205"></a>00205 <a name="l00206"></a>00206 QString SignatureConfigurator::fileURL()<span class="keyword"> const </span>{ <a name="l00207"></a>00207 QString file = mFileRequester->url().stripWhiteSpace(); <a name="l00208"></a>00208 <a name="l00209"></a>00209 <span class="comment">// Force the filename to be relative to ~ instead of $PWD depending</span> <a name="l00210"></a>00210 <span class="comment">// on the rest of the code (KRun::run in Edit and KFileItem on save)</span> <a name="l00211"></a>00211 <span class="keywordflow">if</span> ( !file.isEmpty() && QFileInfo( file ).isRelative() ) <a name="l00212"></a>00212 file = QDir::home().absPath() + QDir::separator() + file; <a name="l00213"></a>00213 <a name="l00214"></a>00214 <span class="keywordflow">return</span> file; <a name="l00215"></a>00215 } <a name="l00216"></a>00216 <a name="l00217"></a>00217 <span class="keywordtype">void</span> SignatureConfigurator::setFileURL( <span class="keyword">const</span> QString & url ) { <a name="l00218"></a>00218 mFileRequester->setURL( url ); <a name="l00219"></a>00219 } <a name="l00220"></a>00220 <a name="l00221"></a>00221 QString SignatureConfigurator::commandURL()<span class="keyword"> const </span>{ <a name="l00222"></a>00222 <span class="keywordflow">return</span> mCommandEdit->text(); <a name="l00223"></a>00223 } <a name="l00224"></a>00224 <a name="l00225"></a>00225 <span class="keywordtype">void</span> SignatureConfigurator::setCommandURL( <span class="keyword">const</span> QString & url ) { <a name="l00226"></a>00226 mCommandEdit->setText( url ); <a name="l00227"></a>00227 } <a name="l00228"></a>00228 <a name="l00229"></a>00229 <a name="l00230"></a>00230 Signature SignatureConfigurator::signature()<span class="keyword"> const </span>{ <a name="l00231"></a>00231 Signature sig; <a name="l00232"></a>00232 sig.setType( signatureType() ); <a name="l00233"></a>00233 sig.setText( inlineText() ); <a name="l00234"></a>00234 <span class="keywordflow">if</span> ( signatureType() == Signature::FromCommand ) <a name="l00235"></a>00235 sig.setUrl( commandURL(), <span class="keyword">true</span> ); <a name="l00236"></a>00236 <span class="keywordflow">if</span> ( signatureType() == Signature::FromFile ) <a name="l00237"></a>00237 sig.setUrl( fileURL(), <span class="keyword">false</span> ); <a name="l00238"></a>00238 <span class="keywordflow">return</span> sig; <a name="l00239"></a>00239 } <a name="l00240"></a>00240 <a name="l00241"></a>00241 <span class="keywordtype">void</span> SignatureConfigurator::setSignature( <span class="keyword">const</span> Signature & sig ) { <a name="l00242"></a>00242 setSignatureType( sig.type() ); <a name="l00243"></a>00243 setInlineText( sig.text() ); <a name="l00244"></a>00244 <span class="keywordflow">if</span> ( sig.type() == Signature::FromFile ) <a name="l00245"></a>00245 setFileURL( sig.url() ); <a name="l00246"></a>00246 <span class="keywordflow">else</span> <a name="l00247"></a>00247 setFileURL( QString::null ); <a name="l00248"></a>00248 <span class="keywordflow">if</span> ( sig.type() == Signature::FromCommand ) <a name="l00249"></a>00249 setCommandURL( sig.url() ); <a name="l00250"></a>00250 <span class="keywordflow">else</span> <a name="l00251"></a>00251 setCommandURL( QString::null ); <a name="l00252"></a>00252 } <a name="l00253"></a>00253 <a name="l00254"></a>00254 <span class="keywordtype">void</span> SignatureConfigurator::slotEnableEditButton( <span class="keyword">const</span> QString & url ) { <a name="l00255"></a>00255 mEditButton->setDisabled( url.stripWhiteSpace().isEmpty() ); <a name="l00256"></a>00256 } <a name="l00257"></a>00257 <a name="l00258"></a>00258 <span class="keywordtype">void</span> SignatureConfigurator::slotEdit() { <a name="l00259"></a>00259 QString url = fileURL(); <a name="l00260"></a>00260 <span class="comment">// slotEnableEditButton should prevent this assert from being hit:</span> <a name="l00261"></a>00261 assert( !url.isEmpty() ); <a name="l00262"></a>00262 <a name="l00263"></a>00263 (void)KRun::runURL( KURL( url ), QString::fromLatin1(<span class="stringliteral">"text/plain"</span>) ); <a name="l00264"></a>00264 } <a name="l00265"></a>00265 <a name="l00266"></a>00266 } <span class="comment">// namespace KMail</span> <a name="l00267"></a>00267 <a name="l00268"></a>00268 <span class="preprocessor">#include "signatureconfigurator.moc"</span> </pre></div></div> </div></div> </td> </tr> <tr> <td valign="top" id="leftmenu" width="25%"> <a name="navigation"></a> <div class="menu_box"><h2>kmail</h2> <div class="nav_list"> <ul><li><a href="index.html">Main Page</a></li><li><a href="namespaces.html">Namespace List</a></li><li><a href="hierarchy.html">Class Hierarchy</a></li><li><a href="classes.html">Alphabetical List</a></li><li><a href="annotated.html">Class List</a></li><li><a href="files.html">File List</a></li><li><a href="namespacemembers.html">Namespace Members</a></li><li><a href="functions.html">Class Members</a></li><li><a href="pages.html">Related Pages</a></li></ul> <!-- <h2>Class Picker</h2> <div style="text-align: center;"> <form name="guideform"> <select name="guidelinks" style="width:100%;" onChange="window.location=document.guideform.guidelinks.options[document.guideform.guidelinks.selectedIndex].value"> <option value="annotated.html">-- Choose --</option> <option value="classAccountUpdater.html">accountupdater</option>, <option value="classAttachmentModifyCommand.html">attachmentmodifycommand</option>, <option value="classFolderStorage.html">folderstorage</option>, <option value="classKCursorSaver.html">kcursorsaver</option>, <option value="classKleo_1_1KeyResolver.html">kleo::keyresolver</option>, <option value="classKListViewIndexedSearchLine.html">klistviewindexedsearchline</option>, <option value="classKMAcctFolder.html">kmacctfolder</option>, <option value="classKMAcctSelDlg.html">kmacctseldlg</option>, <option value="classKMail_1_1AccountComboBox.html">kmail::accountcombobox</option>, <option value="classKMail_1_1AccountManager.html">kmail::accountmanager</option>, <option value="classKMail_1_1ACLEntryDialog.html">kmail::aclentrydialog</option>, <option value="classKMail_1_1ACLJobs_1_1DeleteACLJob.html">kmail::acljobs::deleteacljob</option>, <option value="classKMail_1_1ACLJobs_1_1GetACLJob.html">kmail::acljobs::getacljob</option>, <option value="classKMail_1_1ACLJobs_1_1GetUserRightsJob.html">kmail::acljobs::getuserrightsjob</option>, <option value="classKMail_1_1ACLJobs_1_1MultiSetACLJob.html">kmail::acljobs::multisetacljob</option>, <option value="classKMail_1_1AnnotationJobs_1_1GetAnnotationJob.html">kmail::annotationjobs::getannotationjob</option>, <option value="classKMail_1_1AnnotationJobs_1_1MultiGetAnnotationJob.html">kmail::annotationjobs::multigetannotationjob</option>, <option value="classKMail_1_1AnnotationJobs_1_1MultiSetAnnotationJob.html">kmail::annotationjobs::multisetannotationjob</option>, <option value="classKMail_1_1AnnotationJobs_1_1MultiUrlGetAnnotationJob.html">kmail::annotationjobs::multiurlgetannotationjob</option>, <option value="classKMail_1_1AntiSpamConfig.html">kmail::antispamconfig</option>, <option value="classKMail_1_1AntiSpamWizard.html">kmail::antispamwizard</option>, <option value="classKMail_1_1AntiSpamWizard_1_1ConfigReader.html">kmail::antispamwizard::configreader</option>, <option value="classKMail_1_1AntiSpamWizard_1_1SpamToolConfig.html">kmail::antispamwizard::spamtoolconfig</option>, <option value="classKMail_1_1Callback.html">kmail::callback</option>, <option value="classKMail_1_1CopyFolderJob.html">kmail::copyfolderjob</option>, <option value="classKMail_1_1DictionaryComboBox.html">kmail::dictionarycombobox</option>, <option value="classKMail_1_1EditorWatcher.html">kmail::editorwatcher</option>, <option value="classKMail_1_1FilterImporterExporter.html">kmail::filterimporterexporter</option>, <option value="classKMail_1_1FilterLog.html">kmail::filterlog</option>, <option value="classKMail_1_1FilterLogDialog.html">kmail::filterlogdialog</option>, <option value="classKMail_1_1FolderDiaACLTab.html">kmail::folderdiaacltab</option>, <option value="classKMail_1_1FolderDiaGeneralTab.html">kmail::folderdiageneraltab</option>, <option value="classKMail_1_1FolderDiaQuotaTab.html">kmail::folderdiaquotatab</option>, <option value="classKMail_1_1FolderDiaTab.html">kmail::folderdiatab</option>, <option value="classKMail_1_1FolderDiaTemplatesTab.html">kmail::folderdiatemplatestab</option>, <option value="classKMail_1_1FolderRequester.html">kmail::folderrequester</option>, <option value="classKMail_1_1HeaderItem.html">kmail::headeritem</option>, <option value="classKMail_1_1HeaderStyle.html">kmail::headerstyle</option>, <option value="classKMail_1_1HtmlStatusBar.html">kmail::htmlstatusbar</option>, <option value="classKMail_1_1HtmlWriter.html">kmail::htmlwriter</option>, <option value="classKMail_1_1IdentityDrag.html">kmail::identitydrag</option>, <option value="classKMail_1_1IdentityListView.html">kmail::identitylistview</option>, <option value="classKMail_1_1IdentityListViewItem.html">kmail::identitylistviewitem</option>, <option value="classKMail_1_1Interface_1_1BodyPart.html">kmail::interface::bodypart</option>, <option value="classKMail_1_1Interface_1_1BodyPartFormatterPlugin.html">kmail::interface::bodypartformatterplugin</option>, <option value="classKMail_1_1Interface_1_1BodyPartMemento.html">kmail::interface::bodypartmemento</option>, <option value="classKMail_1_1Interface_1_1BodyPartURLHandler.html">kmail::interface::bodyparturlhandler</option>, <option value="classKMail_1_1Interface_1_1Observable.html">kmail::interface::observable</option>, <option value="classKMail_1_1Interface_1_1Observer.html">kmail::interface::observer</option>, <option value="classKMail_1_1JobScheduler.html">kmail::jobscheduler</option>, <option value="classKMail_1_1ListJob.html">kmail::listjob</option>, <option value="classKMail_1_1MaildirCompactionJob.html">kmail::maildircompactionjob</option>, <option value="classKMail_1_1MailingList.html">kmail::mailinglist</option>, <option value="classKMail_1_1MboxCompactionJob.html">kmail::mboxcompactionjob</option>, <option value="classKMail_1_1MessageActions.html">kmail::messageactions</option>, <option value="classKMail_1_1MessageCopyHelper.html">kmail::messagecopyhelper</option>, <option value="classKMail_1_1PartNodeBodyPart.html">kmail::partnodebodypart</option>, <option value="classKMail_1_1PopAccount.html">kmail::popaccount</option>, <option value="classKMail_1_1QuotaJobs_1_1GetQuotarootJob.html">kmail::quotajobs::getquotarootjob</option>, <option value="classKMail_1_1QuotaJobs_1_1GetStorageQuotaJob.html">kmail::quotajobs::getstoragequotajob</option>, <option value="classKMail_1_1RedirectDialog.html">kmail::redirectdialog</option>, <option value="classKMail_1_1RenameJob.html">kmail::renamejob</option>, <option value="classKMail_1_1RuleWidgetHandler.html">kmail::rulewidgethandler</option>, <option value="classKMail_1_1RuleWidgetHandlerManager.html">kmail::rulewidgethandlermanager</option>, <option value="classKMail_1_1ScheduledCompactionTask.html">kmail::scheduledcompactiontask</option>, <option value="classKMail_1_1ScheduledExpireTask.html">kmail::scheduledexpiretask</option>, <option value="classKMail_1_1ScheduledJob.html">kmail::scheduledjob</option>, <option value="classKMail_1_1ScheduledTask.html">kmail::scheduledtask</option>, <option value="classKMail_1_1SearchJob.html">kmail::searchjob</option>, <option value="classKMail_1_1SearchWindow.html">kmail::searchwindow</option>, <option value="classKMail_1_1SecondaryWindow.html">kmail::secondarywindow</option>, <option value="classKMail_1_1SieveDebugDialog.html">kmail::sievedebugdialog</option>, <option value="classKMail_1_1SortCacheItem.html">kmail::sortcacheitem</option>, <option value="classKMail_1_1SpamHeaderAnalyzer.html">kmail::spamheaderanalyzer</option>, <option value="classKMail_1_1SpamScore.html">kmail::spamscore</option>, <option value="classKMail_1_1TeeHtmlWriter.html">kmail::teehtmlwriter</option>, <option value="classKMail_1_1TransportManager.html">kmail::transportmanager</option>, <option value="classKMail_1_1UndoInfo.html">kmail::undoinfo</option>, <option value="classKMail_1_1URLHandler.html">kmail::urlhandler</option>, <option value="classKMail_1_1URLHandlerManager.html">kmail::urlhandlermanager</option>, <option value="classKMail_1_1Util_1_1LaterDeleter.html">kmail::util::laterdeleter</option>, <option value="classKMailICalIfaceImpl.html">kmailicalifaceimpl</option>, <option value="classKMailIface.html">kmailiface</option>, <option value="classKMDict.html">kmdict</option>, <option value="classKMDictItem.html">kmdictitem</option>, <option value="classKMFilterAction.html">kmfilteraction</option>, <option value="classKMFilterActionDict.html">kmfilteractiondict</option>, <option value="classKMFilterActionWidget.html">kmfilteractionwidget</option>, <option value="classKMFilterActionWithAddress.html">kmfilteractionwithaddress</option>, <option value="classKMFilterActionWithFolder.html">kmfilteractionwithfolder</option>, <option value="classKMFilterActionWithNone.html">kmfilteractionwithnone</option>, <option value="classKMFilterActionWithString.html">kmfilteractionwithstring</option>, <option value="classKMFilterActionWithStringList.html">kmfilteractionwithstringlist</option>, <option value="classKMFilterActionWithUOID.html">kmfilteractionwithuoid</option>, <option value="classKMFilterActionWithUrl.html">kmfilteractionwithurl</option>, <option value="classKMFilterDlg.html">kmfilterdlg</option>, <option value="classKMFilterListBox.html">kmfilterlistbox</option>, <option value="classKMFolder.html">kmfolder</option>, <option value="classKMFolderDialog.html">kmfolderdialog</option>, <option value="classKMFolderDir.html">kmfolderdir</option>, <option value="classKMFolderIndex.html">kmfolderindex</option>, <option value="classKMFolderOpener.html">kmfolderopener</option>, <option value="classKMHeaders.html">kmheaders</option>, <option value="classKMKernel.html">kmkernel</option>, <option value="classKMMenuCommand.html">kmmenucommand</option>, <option value="classKMMessage.html">kmmessage</option>, <option value="classKMMsgDict.html">kmmsgdict</option>, <option value="classKMMsgList.html">kmmsglist</option>, <option value="classKMMsgPartDialog.html">kmmsgpartdialog</option>, <option value="classKMMsgPartDialogCompat.html">kmmsgpartdialogcompat</option>, <option value="classKMPopHeadersView.html">kmpopheadersview</option>, <option value="classKMReaderWin.html">kmreaderwin</option>, <option value="classKMSearchPattern.html">kmsearchpattern</option>, <option value="classKMSearchPatternEdit.html">kmsearchpatternedit</option>, <option value="classKMSearchRule.html">kmsearchrule</option>, <option value="classKMSearchRuleNumerical.html">kmsearchrulenumerical</option>, <option value="classKMSearchRuleStatus.html">kmsearchrulestatus</option>, <option value="classKMSearchRuleString.html">kmsearchrulestring</option>, <option value="classKMSearchRuleWidget.html">kmsearchrulewidget</option>, <option value="classKMSystemTray.html">kmsystemtray</option>, <option value="classMailComposerIface.html">mailcomposeriface</option>, <option value="classScalix_1_1FolderAttributeParser.html">scalix::folderattributeparser</option>, <option value="classSnippetConfig.html">snippetconfig</option>, <option value="classSnippetGroup.html">snippetgroup</option>, <option value="classSnippetItem.html">snippetitem</option>, <option value="classSnippetSettings.html">snippetsettings</option>, <option value="classSnippetWidget.html">snippetwidget</option>, </select> </form> </div> --> </div></div> <div class="menu_box"><h2>API Dox</h2> <div class="nav_list"> <ul> <li><a href="../../akregator/html/index.html">akregator</a></li><li> <a href="../../akregator/src/html/index.html">src</a></li><li> <a href="../../akregator/src/librss/html/index.html">librss</a></li><li><a href="../../certmanager/html/index.html">certmanager</a></li><li> <a href="../../certmanager/lib/html/index.html">lib</a></li><li><a href="../../kaddressbook/html/index.html">kaddressbook</a></li><li><a href="../../kalarm/html/index.html">kalarm</a></li><li> <a href="../../kalarm/lib/html/index.html">lib</a></li><li><a href="../../kandy/html/index.html">kandy</a></li><li><a href="../../karm/html/index.html">karm</a></li><li><a href="../../kdgantt/html/index.html">kdgantt</a></li><li><a href="../../kgantt/html/index.html">kgantt</a></li><li><a href="../../kioslaves/html/index.html">kioslaves</a></li><li> <a href="../../kioslaves/imap4/html/index.html">imap4</a></li><li> <a href="../../kioslaves/mbox/html/index.html">mbox</a></li><li><a href="../../kitchensync/html/index.html">kitchensync</a></li><li><a href="../../kmail/html/index.html">kmail</a></li><li><a href="../../knotes/html/index.html">knotes</a></li><li><a href="../../konsolekalendar/html/index.html">konsolekalendar</a></li><li><a href="../../kontact/html/index.html">kontact</a></li><li><a href="../../korganizer/html/index.html">korganizer</a></li><li><a href="../../kpilot/html/index.html">kpilot</a></li><li> <a href="../../kpilot/kpilot/html/index.html">kpilot</a></li><li> <a href="../../kpilot/lib/html/index.html">lib</a></li><li><a href="../../libemailfunctions/html/index.html">libemailfunctions</a></li><li><a href="../../libkcal/html/index.html">libkcal</a></li><li><a href="../../libkdepim/html/index.html">libkdepim</a></li><li><a href="../../libkholidays/html/index.html">libkholidays</a></li><li><a href="../../libkmime/html/index.html">libkmime</a></li><li><a href="../../libkpgp/html/index.html">libkpgp</a></li><li><a href="../../libkpimidentities/html/index.html">libkpimidentities</a></li> </ul></div></div> </td> </tr> </table> <span class="doNotDisplay"> <a href="http://www.kde.org/" accesskey="8">KDE Home</a> | <a href="http://accessibility.kde.org/" accesskey="9">KDE Accessibility Home</a> | <a href="http://www.kde.org/media/accesskeys.php" accesskey="0">Description of Access Keys</a> </span> <div style="height: 8px"></div> <div id="footer"> <div id="footer_left"> Maintained by <a href="mailto:groot@kde.org">Adriaan de Groot</a> and <a href="mailto:winter@kde.org">Allen Winter</a>. <br/> KDE and K Desktop Environment are trademarks of <a href="http://www.kde.org/areas/kde-ev/" title="Homepage of the KDE non-profit Organization">KDE e.V.</a> | <a href="http://www.kde.org/contact/impressum.php">Legal</a> </div> <div id="footer_right"><img src="/media/images/footer_right.png" style="margin: 0px" alt="" /></div> </div> <!-- WARNING: DO NOT SEND MAIL TO THE FOLLOWING EMAIL ADDRESS! YOU WILL BE BLOCKED INSTANTLY AND PERMANENTLY! <a href="mailto:aaaatrap-425acc3b5374943f@kde.org">Block me</a> WARNING END --> </body> </html>