summaryrefslogtreecommitdiffabout
path: root/kmicromail/selectsmtp.cpp
blob: ff8b5245e33a22e2c53bfb415af557615b22c8af (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
#include "selectsmtp.h"
#include <libmailwrapper/mailwrapper.h>

#include <qcombobox.h>
#include <qcheckbox.h>
#include <qmessagebox.h>
#include <qpushbutton.h>
#include <qlineedit.h>
#include <qlabel.h>
#include <qtabwidget.h>
#include <qlistview.h>
#include <klocale.h>
selectsmtp::selectsmtp(QWidget* parent, const char* name, bool modal, WFlags fl)
    : selectstoreui(parent,name,modal,fl)
{
    //m_smtpList.setAutoDelete(false);
    m_smtpList = 0;
    //headlabel->setText(i18n("<center>Select SMTP account to use</center>"));
    headlabel->hide();
    folderSelection->hide();
    folderLabel->hide();
    accountlabel->setText("<center>SMTP Accounts</center>");
    Line1->hide();
    newFoldersel->hide();
    newFolderedit->hide();
    newFolderLabel->hide();
    Line2->hide();
    selMove->hide();
    m_current_smtp = 0;
    setCaption(i18n("Select SMTP Account"));
}

selectsmtp::~selectsmtp()
{
}

void selectsmtp::slotAccountselected(int which)
{
    if (!m_smtpList || (unsigned)which>=m_smtpList->count() || which < 0) {
        m_current_smtp = 0;
        return;
    }
    m_current_smtp = m_smtpList->at(which);
}

void selectsmtp::setSelectionlist(QList<SMTPaccount>*list)
{
    m_smtpList = list;
    accountSelection->clear();
    if (!m_smtpList || m_smtpList->count()==0) {
        accountSelection->setEnabled(false);
        return;
    }
    accountSelection->setEnabled(true);
    for (unsigned i = 0; m_smtpList!=0 && i < m_smtpList->count(); ++i) {
        accountSelection->insertItem( m_smtpList->at(i)->getAccountName());
    }
    m_current_smtp = m_smtpList->at(0);
}

SMTPaccount*selectsmtp::selected_smtp()
{
    return m_current_smtp;
}