Commit 4b8dbe97 authored by Volker Krause's avatar Volker Krause
Browse files

use an integer for the port number instead of a string

svn path=/trunk/KDE/kdepim/mailtransport/; revision=619903
parent 23762ced
......@@ -28,7 +28,6 @@ TransportComboBox
Transport
---------
- use int for port number instead of QString
- password is not reloaded from wallet on remote change
TransportJob
......
......@@ -33,7 +33,7 @@
<label>Host name of the server</label>
<whatsthis>The domain name or numerical address of the SMTP server.</whatsthis>
</entry>
<entry name="port" type="String">
<entry name="port" type="UInt">
<label>Port number of the server</label>
<whatsthis>The port number that the SMTP server is listening on. The default port is 25.</whatsthis>
<default>25</default>
......
......@@ -94,7 +94,7 @@ void SmtpJob::doStart()
destination.setProtocol( (transport()->encryption() == Transport::EnumEncryption::SSL) ? SMTPS_PROTOCOL : SMTP_PROTOCOL );
destination.setHost( transport()->host() );
destination.setPort( transport()->port().toUShort() );
destination.setPort( transport()->port() );
if ( transport()->requiresAuthentication() ) {
if( (transport()->userName().isEmpty() || transport()->password().isEmpty())
......
......@@ -6,8 +6,8 @@
<rect>
<x>0</x>
<y>0</y>
<width>432</width>
<height>524</height>
<width>424</width>
<height>544</height>
</rect>
</property>
<property name="windowTitle" >
......@@ -52,7 +52,33 @@
<property name="spacing" >
<number>6</number>
</property>
<item row="12" column="1" >
<item row="2" column="3" >
<spacer>
<property name="orientation" >
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" >
<size>
<width>40</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
<item row="2" column="1" >
<widget class="KIntNumInput" name="kcfg_port" >
<property name="value" >
<number>25</number>
</property>
<property name="minimum" >
<number>0</number>
</property>
<property name="maximum" >
<number>65536</number>
</property>
</widget>
</item>
<item row="12" column="2" >
<spacer>
<property name="orientation" >
<enum>Qt::Vertical</enum>
......@@ -78,7 +104,7 @@
</property>
</widget>
</item>
<item row="11" column="1" >
<item row="11" column="1" colspan="3" >
<widget class="KLineEdit" name="kcfg_localHostname" >
<property name="enabled" >
<bool>false</bool>
......@@ -105,19 +131,9 @@
</property>
</widget>
</item>
<item row="0" column="1" >
<item row="0" column="1" colspan="3" >
<widget class="KLineEdit" name="kcfg_name" />
</item>
<item row="2" column="0" >
<widget class="QLabel" name="portLabel" >
<property name="text" >
<string>&amp;Port:</string>
</property>
<property name="buddy" >
<cstring>kcfg_port</cstring>
</property>
</widget>
</item>
<item row="3" column="0" >
<widget class="QLabel" name="precommandLabel" >
<property name="text" >
......@@ -128,16 +144,10 @@
</property>
</widget>
</item>
<item row="1" column="1" >
<widget class="KLineEdit" name="kcfg_host" />
</item>
<item row="2" column="1" >
<widget class="KLineEdit" name="kcfg_port" />
</item>
<item row="3" column="1" >
<item row="3" column="1" colspan="3" >
<widget class="KLineEdit" name="kcfg_precommand" />
</item>
<item row="6" column="1" >
<item row="6" column="1" colspan="3" >
<widget class="KLineEdit" name="kcfg_userName" >
<property name="enabled" >
<bool>false</bool>
......@@ -170,7 +180,7 @@
</property>
</widget>
</item>
<item row="7" column="1" >
<item row="7" column="1" colspan="3" >
<widget class="KLineEdit" name="password" >
<property name="enabled" >
<bool>false</bool>
......@@ -183,7 +193,7 @@
</property>
</widget>
</item>
<item row="8" column="0" colspan="2" >
<item row="8" column="0" colspan="4" >
<widget class="QCheckBox" name="kcfg_storePassword" >
<property name="enabled" >
<bool>false</bool>
......@@ -193,26 +203,39 @@
</property>
</widget>
</item>
<item row="4" column="0" colspan="2" >
<item row="4" column="0" colspan="4" >
<widget class="KSeparator" name="kseparator_2" />
</item>
<item row="9" column="0" colspan="2" >
<item row="9" column="0" colspan="4" >
<widget class="KSeparator" name="kseparator_3" />
</item>
<item row="5" column="0" colspan="2" >
<item row="5" column="0" colspan="4" >
<widget class="QCheckBox" name="kcfg_requiresAuthentication" >
<property name="text" >
<string>Server &amp;requires authentication</string>
</property>
</widget>
</item>
<item row="10" column="0" colspan="2" >
<item row="10" column="0" colspan="4" >
<widget class="QCheckBox" name="kcfg_specifyHostname" >
<property name="text" >
<string>Sen&amp;d custom hostname to server</string>
</property>
</widget>
</item>
<item row="1" column="1" colspan="3" >
<widget class="KLineEdit" name="kcfg_host" />
</item>
<item row="2" column="0" >
<widget class="QLabel" name="portLabel" >
<property name="text" >
<string>&amp;Port:</string>
</property>
<property name="buddy" >
<cstring>kcfg_port</cstring>
</property>
</widget>
</item>
</layout>
</widget>
<widget class="QWidget" name="securityTab" >
......@@ -364,15 +387,9 @@
<layoutfunction spacing="KDialog::spacingHint()" margin="KDialog::marginHint()" />
<customwidgets>
<customwidget>
<class>KButtonGroup</class>
<extends>QGroupBox</extends>
<header>kbuttongroup.h</header>
<container>1</container>
</customwidget>
<customwidget>
<class>KPushButton</class>
<extends>QPushButton</extends>
<header>kpushbutton.h</header>
<class>KLineEdit</class>
<extends>QLineEdit</extends>
<header>klineedit.h</header>
</customwidget>
<customwidget>
<class>KSeparator</class>
......@@ -380,9 +397,20 @@
<header>kseparator.h</header>
</customwidget>
<customwidget>
<class>KLineEdit</class>
<extends>QLineEdit</extends>
<header>klineedit.h</header>
<class>KIntNumInput</class>
<extends>QWidget</extends>
<header>knuminput.h</header>
</customwidget>
<customwidget>
<class>KPushButton</class>
<extends>QPushButton</extends>
<header>kpushbutton.h</header>
</customwidget>
<customwidget>
<class>KButtonGroup</class>
<extends>QGroupBox</extends>
<header>kbuttongroup.h</header>
<container>1</container>
</customwidget>
</customwidgets>
<tabstops>
......@@ -417,12 +445,12 @@
<slot>setEnabled(bool)</slot>
<hints>
<hint type="sourcelabel" >
<x>141</x>
<y>215</y>
<x>152</x>
<y>254</y>
</hint>
<hint type="destinationlabel" >
<x>162</x>
<y>242</y>
<x>175</x>
<y>287</y>
</hint>
</hints>
</connection>
......@@ -433,12 +461,12 @@
<slot>setEnabled(bool)</slot>
<hints>
<hint type="sourcelabel" >
<x>228</x>
<y>215</y>
<x>239</x>
<y>254</y>
</hint>
<hint type="destinationlabel" >
<x>229</x>
<y>271</y>
<x>242</x>
<y>322</y>
</hint>
</hints>
</connection>
......@@ -449,12 +477,12 @@
<slot>setEnabled(bool)</slot>
<hints>
<hint type="sourcelabel" >
<x>68</x>
<y>215</y>
<x>79</x>
<y>254</y>
</hint>
<hint type="destinationlabel" >
<x>78</x>
<y>244</y>
<x>89</x>
<y>289</y>
</hint>
</hints>
</connection>
......@@ -465,12 +493,12 @@
<slot>setEnabled(bool)</slot>
<hints>
<hint type="sourcelabel" >
<x>118</x>
<y>215</y>
<x>129</x>
<y>254</y>
</hint>
<hint type="destinationlabel" >
<x>78</x>
<y>273</y>
<x>89</x>
<y>324</y>
</hint>
</hints>
</connection>
......@@ -481,12 +509,12 @@
<slot>setEnabled(bool)</slot>
<hints>
<hint type="sourcelabel" >
<x>200</x>
<y>334</y>
<x>211</x>
<y>397</y>
</hint>
<hint type="destinationlabel" >
<x>193</x>
<y>361</y>
<x>206</x>
<y>430</y>
</hint>
</hints>
</connection>
......@@ -497,12 +525,12 @@
<slot>setEnabled(bool)</slot>
<hints>
<hint type="sourcelabel" >
<x>120</x>
<y>334</y>
<x>131</x>
<y>397</y>
</hint>
<hint type="destinationlabel" >
<x>78</x>
<y>363</y>
<x>89</x>
<y>432</y>
</hint>
</hints>
</connection>
......@@ -513,12 +541,12 @@
<slot>setEnabled(bool)</slot>
<hints>
<hint type="sourcelabel" >
<x>50</x>
<y>215</y>
<x>61</x>
<y>254</y>
</hint>
<hint type="destinationlabel" >
<x>58</x>
<y>299</y>
<x>69</x>
<y>356</y>
</hint>
</hints>
</connection>
......@@ -529,12 +557,12 @@
<slot>setEnabled(bool)</slot>
<hints>
<hint type="sourcelabel" >
<x>215</x>
<y>205</y>
<x>226</x>
<y>254</y>
</hint>
<hint type="destinationlabel" >
<x>215</x>
<y>285</y>
<x>110</x>
<y>102</y>
</hint>
</hints>
</connection>
......
......@@ -43,7 +43,7 @@ Transport::Transport( const QString &cfgGroup ) :
bool Transport::isValid() const
{
return id() > 0 && !host().isEmpty();
return id() > 0 && !host().isEmpty() && port() <= 65536;
}
QString Transport::password()
......
File=mailtransport.kcfg
ClassName=TransportBase
NameSpace=KPIM
Mutators=true
ItemAccessors=true
SetUserTexts=true
......
......@@ -162,7 +162,7 @@ void TransportConfigDialog::checkSmtpCapabilities()
Q_ASSERT( d->transport->type() == Transport::EnumType::SMTP );
delete d->serverTest;
d->serverTest = new ServerTest( SMTP_PROTOCOL, d->smtp.kcfg_host->text(), d->smtp.kcfg_port->text().toInt() );
d->serverTest = new ServerTest( SMTP_PROTOCOL, d->smtp.kcfg_host->text(), d->smtp.kcfg_port->value() );
connect( d->serverTest,
SIGNAL( capabilities(QStringList,QStringList,QString,QString,QString)),
SLOT( smtpCapabilities(QStringList,QStringList,QString,QString,QString)) );
......@@ -313,11 +313,11 @@ void TransportConfigDialog::encryptionChanged(int enc)
// adjust port
if ( enc == Transport::EnumEncryption::SSL ) {
if ( d->smtp.kcfg_port->text() == QString::number( SMTP_PORT ) )
d->smtp.kcfg_port->setText( QString::number( SMTPS_PORT ) );
if ( d->smtp.kcfg_port->value() == SMTP_PORT )
d->smtp.kcfg_port->setValue( SMTPS_PORT );
} else {
if ( d->smtp.kcfg_port->text() == QString::number( SMTPS_PORT ) )
d->smtp.kcfg_port->setText( QString::number( SMTP_PORT ) );
if ( d->smtp.kcfg_port->value() == SMTPS_PORT )
d->smtp.kcfg_port->setValue( SMTP_PORT );
}
// adjust available authentication methods
......
......@@ -425,6 +425,7 @@ void TransportManager::migrateToWallet()
void TransportManager::dbusServiceOwnerChanged(const QString & service, const QString & oldOwner, const QString & newOwner)
{
Q_UNUSED( oldOwner );
if ( service == DBUS_SERVICE_NAME && newOwner.isEmpty() )
QDBusConnection::sessionBus().registerService( DBUS_SERVICE_NAME );
}
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment