summaryrefslogtreecommitdiffabout
path: root/kmicromail/selectstore.cpp
blob: 0a07d51bd3f96b4b82ee5223b8a164559b2c3ef5 (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
65
66
67
68
69
70
#include "selectstore.h"
#include <qlineedit.h>
#include <qcheckbox.h>
#include <qcombobox.h>
#include <libmailwrapper/abstractmail.h>

Selectstore::Selectstore(QWidget* parent, const char* name)
    :selectstoreui(parent,name,true)
{
    folderMap.clear();
    mailMap.clear();
    cMail = 0;
}

Selectstore::~Selectstore()
{
}

void Selectstore::slotCreateNewFolder()
{
    bool how = newFoldersel->isChecked();
    folderSelection->setEnabled(!how);
    newFolderedit->setEnabled(how);
}

void Selectstore::slotMoveMail()
{
}

void Selectstore::addAccounts(AbstractMail*mail,const QStringList&folders)
{
    accountSelection->insertItem(mail->getName());
    mailMap[accountSelection->count()-1]=mail;
    folderMap[accountSelection->count()-1]=folders;
    if (accountSelection->count()==1) {
        cMail = mail;
        folderSelection->insertStringList(folders);
    }
}

void Selectstore::slotAccountselected(int i)
{
    folderSelection->clear();
    folderSelection->insertStringList(folderMap[i]);
    cMail = mailMap[i];
}

QString Selectstore::currentFolder()
{
    if (newFoldersel->isChecked()) {
        return newFolderedit->text();
    } else {
        return folderSelection->currentText();
    }
}

AbstractMail*Selectstore::currentMail()
{
    return cMail;
}

bool Selectstore::newFolder()
{
    return newFoldersel->isChecked();
}

bool Selectstore::moveMails()
{
    return selMove->isChecked();
}