summaryrefslogtreecommitdiff
Side-by-side diff
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--noncore/net/mail/editaccounts.cpp21
-rw-r--r--noncore/net/mail/editaccounts.h2
-rw-r--r--noncore/net/mail/imapconfigui.ui159
-rw-r--r--noncore/net/mail/libmailwrapper/imapwrapper.cpp36
-rw-r--r--noncore/net/mail/libmailwrapper/settings.cpp2
5 files changed, 129 insertions, 91 deletions
diff --git a/noncore/net/mail/editaccounts.cpp b/noncore/net/mail/editaccounts.cpp
index 9fc97e8..1cb202e 100644
--- a/noncore/net/mail/editaccounts.cpp
+++ b/noncore/net/mail/editaccounts.cpp
@@ -267,11 +267,20 @@ IMAPconfig::IMAPconfig( IMAPaccount *account, QWidget *parent, const char *name,
fillValues();
- connect( sslBox, SIGNAL( toggled( bool ) ), SLOT( slotSSL( bool ) ) );
+ connect( ComboBox1, SIGNAL( activated( int ) ), SLOT( slotConnectionToggle( int ) ) );
+ ComboBox1->insertItem( "Only if available", 0 );
+ ComboBox1->insertItem( "Always, Negotiated", 1 );
+ ComboBox1->insertItem( "Connect on secure port", 2 );
+ ComboBox1->insertItem( "Run command instead", 3 );
+ CommandEdit->hide();
+ ComboBox1->setCurrentItem( data->ConnectionType() );
}
-void IMAPconfig::slotSSL( bool enabled )
+void IMAPconfig::slotConnectionToggle( int index )
{
- if ( enabled ) {
- portLine->setText( IMAP_SSL_PORT );
+ if ( index == 2 ) {
+ portLine->setText( IMAP_SSL_PORT );
+ } else if ( index == 3 ) {
+ portLine->setText( IMAP_PORT );
+ CommandEdit->show();
} else {
portLine->setText( IMAP_PORT );
@@ -284,5 +293,5 @@ void IMAPconfig::fillValues()
serverLine->setText( data->getServer() );
portLine->setText( data->getPort() );
- sslBox->setChecked( data->getSSL() );
+ ComboBox1->setCurrentItem( data->ConnectionType() );
userLine->setText( data->getUser() );
passLine->setText( data->getPassword() );
@@ -295,5 +304,5 @@ void IMAPconfig::accept()
data->setServer( serverLine->text() );
data->setPort( portLine->text() );
- data->setSSL( sslBox->isChecked() );
+ data->setConnectionType( ComboBox1->currentItem() );
data->setUser( userLine->text() );
data->setPassword( passLine->text() );
diff --git a/noncore/net/mail/editaccounts.h b/noncore/net/mail/editaccounts.h
index d51e299..d8e1219 100644
--- a/noncore/net/mail/editaccounts.h
+++ b/noncore/net/mail/editaccounts.h
@@ -80,5 +80,5 @@ public slots:
protected slots:
- void slotSSL( bool enabled );
+ void slotConnectionToggle( int index );
void accept();
diff --git a/noncore/net/mail/imapconfigui.ui b/noncore/net/mail/imapconfigui.ui
index ac0297f..a96c1a2 100644
--- a/noncore/net/mail/imapconfigui.ui
+++ b/noncore/net/mail/imapconfigui.ui
@@ -12,6 +12,6 @@
<x>0</x>
<y>0</y>
- <width>228</width>
- <height>320</height>
+ <width>425</width>
+ <height>428</height>
</rect>
</property>
@@ -33,28 +33,6 @@
<property stdset="1">
<name>spacing</name>
- <number>2</number>
+ <number>3</number>
</property>
- <widget row="6" column="0" >
- <class>QLabel</class>
- <property stdset="1">
- <name>name</name>
- <cstring>userLabel</cstring>
- </property>
- <property stdset="1">
- <name>text</name>
- <string>User</string>
- </property>
- </widget>
- <widget row="4" column="1" >
- <class>QCheckBox</class>
- <property stdset="1">
- <name>name</name>
- <cstring>sslBox</cstring>
- </property>
- <property stdset="1">
- <name>text</name>
- <string>Use SSL</string>
- </property>
- </widget>
<widget row="2" column="1" >
<class>QLineEdit</class>
@@ -64,22 +42,4 @@
</property>
</widget>
- <widget row="6" column="1" >
- <class>QLineEdit</class>
- <property stdset="1">
- <name>name</name>
- <cstring>userLine</cstring>
- </property>
- </widget>
- <widget row="7" column="0" >
- <class>QLabel</class>
- <property stdset="1">
- <name>name</name>
- <cstring>passLabel</cstring>
- </property>
- <property stdset="1">
- <name>text</name>
- <string>Password</string>
- </property>
- </widget>
<widget row="3" column="0" >
<class>QLabel</class>
@@ -111,16 +71,38 @@
</property>
</widget>
- <widget row="7" column="1" >
+ <widget row="0" column="1" >
<class>QLineEdit</class>
<property stdset="1">
<name>name</name>
- <cstring>passLine</cstring>
+ <cstring>accountLine</cstring>
+ </property>
+ <property>
+ <name>toolTip</name>
+ <string>Name of the Account</string>
</property>
+ </widget>
+ <widget row="0" column="0" >
+ <class>QLabel</class>
<property stdset="1">
- <name>echoMode</name>
- <enum>Password</enum>
+ <name>name</name>
+ <cstring>accountLabel</cstring>
+ </property>
+ <property stdset="1">
+ <name>text</name>
+ <string>Account</string>
+ </property>
+ </widget>
+ <widget row="1" column="0" rowspan="1" colspan="2" >
+ <class>Line</class>
+ <property stdset="1">
+ <name>name</name>
+ <cstring>line1</cstring>
+ </property>
+ <property stdset="1">
+ <name>orientation</name>
+ <enum>Horizontal</enum>
</property>
</widget>
- <spacer row="10" column="1" >
+ <spacer row="12" column="1" >
<property>
<name>name</name>
@@ -143,38 +125,34 @@
</property>
</spacer>
- <widget row="0" column="1" >
+ <widget row="8" column="1" >
<class>QLineEdit</class>
<property stdset="1">
<name>name</name>
- <cstring>accountLine</cstring>
- </property>
- <property>
- <name>toolTip</name>
- <string>Name of the Account</string>
+ <cstring>userLine</cstring>
</property>
</widget>
- <widget row="0" column="0" >
- <class>QLabel</class>
+ <widget row="9" column="1" >
+ <class>QLineEdit</class>
<property stdset="1">
<name>name</name>
- <cstring>accountLabel</cstring>
+ <cstring>passLine</cstring>
</property>
<property stdset="1">
- <name>text</name>
- <string>Account</string>
+ <name>echoMode</name>
+ <enum>Password</enum>
</property>
</widget>
- <widget row="1" column="0" rowspan="1" colspan="2" >
- <class>Line</class>
+ <widget row="11" column="0" >
+ <class>QLabel</class>
<property stdset="1">
<name>name</name>
- <cstring>line1</cstring>
+ <cstring>prefixLabel</cstring>
</property>
<property stdset="1">
- <name>orientation</name>
- <enum>Horizontal</enum>
+ <name>text</name>
+ <string>Prefix</string>
</property>
</widget>
- <widget row="9" column="1" >
+ <widget row="11" column="1" >
<class>QLineEdit</class>
<property stdset="1">
@@ -183,16 +161,16 @@
</property>
</widget>
- <widget row="9" column="0" >
+ <widget row="8" column="0" >
<class>QLabel</class>
<property stdset="1">
<name>name</name>
- <cstring>prefixLabel</cstring>
+ <cstring>userLabel</cstring>
</property>
<property stdset="1">
<name>text</name>
- <string>Prefix</string>
+ <string>User</string>
</property>
</widget>
- <widget row="5" column="0" rowspan="1" colspan="2" >
+ <widget row="7" column="0" rowspan="1" colspan="2" >
<class>Line</class>
<property stdset="1">
@@ -219,5 +197,5 @@
</property>
</widget>
- <widget row="8" column="0" rowspan="1" colspan="2" >
+ <widget row="10" column="0" rowspan="1" colspan="2" >
<class>Line</class>
<property stdset="1">
@@ -230,4 +208,44 @@
</property>
</widget>
+ <widget row="9" column="0" >
+ <class>QLabel</class>
+ <property stdset="1">
+ <name>name</name>
+ <cstring>passLabel</cstring>
+ </property>
+ <property stdset="1">
+ <name>text</name>
+ <string>Password</string>
+ </property>
+ </widget>
+ <widget row="6" column="0" rowspan="1" colspan="2" >
+ <class>QLineEdit</class>
+ <property stdset="1">
+ <name>name</name>
+ <cstring>CommandEdit</cstring>
+ </property>
+ <property stdset="1">
+ <name>text</name>
+ <string>ssh $SERVER exec</string>
+ </property>
+ </widget>
+ <widget row="5" column="0" rowspan="1" colspan="2" >
+ <class>QComboBox</class>
+ <property stdset="1">
+ <name>name</name>
+ <cstring>ComboBox1</cstring>
+ </property>
+ </widget>
+ <widget row="4" column="0" rowspan="1" colspan="2" >
+ <class>QLabel</class>
+ <property stdset="1">
+ <name>name</name>
+ <cstring>TextLabel1</cstring>
+ </property>
+ <property stdset="1">
+ <name>text</name>
+ <string>Use secure sockets:</string>
+ </property>
+ </widget>
</grid>
</widget>
@@ -236,5 +254,4 @@
<tabstop>serverLine</tabstop>
<tabstop>portLine</tabstop>
- <tabstop>sslBox</tabstop>
<tabstop>userLine</tabstop>
<tabstop>passLine</tabstop>
diff --git a/noncore/net/mail/libmailwrapper/imapwrapper.cpp b/noncore/net/mail/libmailwrapper/imapwrapper.cpp
index 4b633ea..1c22c26 100644
--- a/noncore/net/mail/libmailwrapper/imapwrapper.cpp
+++ b/noncore/net/mail/libmailwrapper/imapwrapper.cpp
@@ -81,6 +81,16 @@ void IMAPwrapper::login()
m_imap = mailimap_new( 20, &imap_progress );
+
+
/* connect */
- if (account->getSSL()) {
+
+ bool ssl = false;
+
+ if ( account->ConnectionType() == 2 ) {
+ ssl = true;
+ }
+
+ if ( ssl ) {
+ qDebug( "using ssl" );
err = mailimap_ssl_connect( m_imap, (char*)server, port );
} else {
@@ -370,5 +380,5 @@ RecMail*IMAPwrapper::parse_list_result(mailimap_msg_att* m_att)
qDebug("%i %i %i - %i %i %i",d->dt_year,d->dt_month,d->dt_day,d->dt_hour,d->dt_min,d->dt_sec);
qDebug(da.toString());
-#endif
+#endif
} else if (item->att_data.att_static->att_type==MAILIMAP_MSG_ATT_RFC822_SIZE) {
size = item->att_data.att_static->att_data.att_rfc822_size;
@@ -409,5 +419,5 @@ RecBody IMAPwrapper::fetchBody(const RecMail&mail)
return body;
}
-
+
/* the range has to start at 1!!! not with 0!!!! */
set = mailimap_set_new_interval( mail.getNumber(),mail.getNumber() );
@@ -496,7 +506,7 @@ encodedString*IMAPwrapper::fetchRawPart(const RecMail&mail,const QValueList<int>
}
set = mailimap_set_new_single(mail.getNumber());
-
+
clist*id_list = 0;
-
+
/* if path == empty then its a request for the whole rfc822 mail and generates
a "fetch <id> (body[])" statement on imap server */
@@ -511,15 +521,15 @@ encodedString*IMAPwrapper::fetchRawPart(const RecMail&mail,const QValueList<int>
section_spec = mailimap_section_spec_new(MAILIMAP_SECTION_SPEC_SECTION_PART, NULL, section_part, NULL);
}
-
+
section = mailimap_section_new(section_spec);
fetch_att = mailimap_fetch_att_new_body_section(section);
fetchType = mailimap_fetch_type_new_fetch_att(fetch_att);
-
+
clist*result = 0;
-
+
err = mailimap_fetch( m_imap, set, fetchType, &result );
mailimap_set_free( set );
mailimap_fetch_type_free( fetchType );
-
+
if (err == MAILIMAP_NO_ERROR && (current=clist_begin(result)) ) {
mailimap_msg_att * msg_att;
@@ -536,5 +546,5 @@ encodedString*IMAPwrapper::fetchRawPart(const RecMail&mail,const QValueList<int>
}
}
- }
+ }
} else {
qDebug("error fetching text: %s",m_imap->imap_response);
@@ -665,9 +675,9 @@ void IMAPwrapper::fillSingleMsgPart(RecPart&target_part,mailimap_body_type_msg*w
/* we set this type to text/plain */
target_part.setLines(which->bd_lines);
- fillBodyFields(target_part,which->bd_fields);
+ fillBodyFields(target_part,which->bd_fields);
}
void IMAPwrapper::fillMultiPart(RecPart&target_part,mailimap_body_type_mpart*which)
-{
+{
if (!which) return;
QString sub = which->bd_media_subtype;
@@ -681,5 +691,5 @@ void IMAPwrapper::fillMultiPart(RecPart&target_part,mailimap_body_type_mpart*whi
target_part.addParameter(QString(param->pa_name).lower(),QString(param->pa_value));
}
- }
+ }
}
}
diff --git a/noncore/net/mail/libmailwrapper/settings.cpp b/noncore/net/mail/libmailwrapper/settings.cpp
index 7b6a58d..3279f39 100644
--- a/noncore/net/mail/libmailwrapper/settings.cpp
+++ b/noncore/net/mail/libmailwrapper/settings.cpp
@@ -165,4 +165,5 @@ void IMAPaccount::read()
port = conf->readEntry( "Port","" );
if (port.isNull()) port="143";
+ connectionType = conf->readNumEntry( "ConnectionType" );
ssl = conf->readBoolEntry( "SSL",false );
user = conf->readEntry( "User","" );
@@ -187,4 +188,5 @@ void IMAPaccount::save()
conf->writeEntry( "Port", port );
conf->writeEntry( "SSL", ssl );
+ conf->writeEntry( "ConnectionType", connectionType );
conf->writeEntry( "User", user );
conf->writeEntryCrypt( "Password", password );