summaryrefslogtreecommitdiffstats
path: root/ksquirrel/imageedit/sq_imageeditoptions.ui.h
blob: 5d73d15f6d2ea76d0d54835cf874ab3bab87833d (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
/****************************************************************************
** ui.h extension file, included from the uic-generated form implementation.
**
** If you wish to add, delete or rename functions or slots use
** Qt Designer which will update this file, preserving your code. Create an
** init() function in place of a constructor, and a destroy() function in
** place of a destructor.
*****************************************************************************/

void SQ_ImageEditOptions::init()
{
    KFile::Mode mode = static_cast<KFile::Mode>(KFile::Directory | KFile::ExistingOnly | KFile::LocalOnly);
    kurl->setMode(mode);
}

int SQ_ImageEditOptions::exec(SQ_ImageOptions *o)
{
    kurl->setURL(o->putto);

    QButton *b = buttonGroup1->find(o->where_to_put);

    if(b)
        b->animateClick();
    else
    {
        qWarning("SQ_ImageEditOptions::exec: wrong button Id");
        radioCurrentDir->animateClick();
    }

    checkClose->setChecked(o->close);

    int result = QDialog::exec();

    if(result == QDialog::Accepted)
    {
        o->putto = (kurl->isEnabled()) ? kurl->url() : QString::null;
        o->where_to_put = buttonGroup1->selectedId();
        o->close = checkClose->isChecked();

        SQ_Config::instance()->setGroup("Image edit options");
        SQ_Config::instance()->writeEntry(prefix + "_putto", o->putto);
        SQ_Config::instance()->writeEntry(prefix + "_where_to_put", o->where_to_put);
        SQ_Config::instance()->writeEntry(prefix + "_close", o->close);
    }

    return result;
}

void SQ_ImageEditOptions::setConfigPrefix( const QString &pr )
{
    prefix = pr;
}