~ubuntu-branches/ubuntu/raring/skanlite/raring

« back to all changes in this revision

Viewing changes to SaveLocation.cpp

  • Committer: Package Import Robot
  • Author(s): Felix Geyer
  • Date: 2012-01-06 20:18:11 UTC
  • mfrom: (1.1.14)
  • Revision ID: package-import@ubuntu.com-20120106201811-46qnlezawwe1vspu
Tags: 0.8-1ubuntu1
* Merge from Debian experimental, remaining changes:
  - Do not suggest skanlite-dbg.

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
/* ============================================================
2
 
* Date        : 2010-07-07
3
 
* Description : Save location settings dialog.
4
 
*
5
 
* Copyright (C) 2010 by Kare Sars <kare dot sars at iki dot fi>
6
 
*
7
 
* This program is free software; you can redistribute it and/or
8
 
* modify it under the terms of the GNU General Public License as
9
 
* published by the Free Software Foundation; either version 2 of
10
 
* the License or (at your option) version 3 or any later version
11
 
* accepted by the membership of KDE e.V. (or its successor approved
12
 
*  by the membership of KDE e.V.), which shall act as a proxy
13
 
* defined in Section 14 of version 3 of the license.
14
 
*
15
 
* This program is distributed in the hope that it will be useful,
16
 
* but WITHOUT ANY WARRANTY; without even the implied warranty of
17
 
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
18
 
* GNU General Public License for more details.
19
 
*
20
 
* You should have received a copy of the GNU General Public License.
21
 
* along with this program.  If not, see <http://www.gnu.org/licenses/>
22
 
*
23
 
* ============================================================ */
24
 
 
25
 
#include "SaveLocation.h"
26
 
#include "SaveLocation.moc"
27
 
 
28
 
#include <KDebug>
29
 
#include <KFileDialog>
30
 
 
31
 
SaveLocation::SaveLocation(QWidget *parent) : KDialog(parent)
32
 
{
33
 
    QWidget *container = new QWidget(this);
34
 
    setupUi(container);
35
 
    setMainWidget(container);
36
 
    connect(saveDirLEdit, SIGNAL(textChanged(QString)), this, SLOT(update()));
37
 
    connect(imgPrefix,    SIGNAL(textChanged(QString)), this, SLOT(update()));
38
 
    connect(imgFormat,    SIGNAL(activated(QString)),   this, SLOT(update()));
39
 
    connect(getDirButton, SIGNAL(clicked()),            this, SLOT(getDir()));
40
 
}
41
 
 
42
 
// ------------------------------------------------------------------------
43
 
SaveLocation::~SaveLocation()
44
 
{
45
 
}
46
 
 
47
 
// ------------------------------------------------------------------------
48
 
void SaveLocation::update()
49
 
{
50
 
    QString name = QString("%1%2.%3").arg(imgPrefix->text()).arg("0123").arg(imgFormat->currentText());
51
 
    resultValue->setText(QFileInfo(saveDirLEdit->text(), name).absoluteFilePath());
52
 
}
53
 
 
54
 
// ------------------------------------------------------------------------
55
 
void SaveLocation::getDir(void)
56
 
{
57
 
    QString newDir = KFileDialog::getExistingDirectory(saveDirLEdit->text());
58
 
    if (!newDir.isEmpty()) {
59
 
        saveDirLEdit->setText(newDir);
60
 
    }
61
 
}