summaryrefslogtreecommitdiffstats
path: root/kipi-plugins/kameraklient/savefiledialog.cpp
blob: e5f2109c8e8d104c34a835ee9b17ae9c38d631f6 (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
71
72
73
74
75
/* ============================================================
 * Copyright 2003 by Renchi Raju <renchi@pooh.tam.uiuc.edu>
 * Copyright 2004 by Tudor Calin <tudor@1xtech.com>

 * This program is free software; you can redistribute it
 * and/or modify it under the terms of the GNU General
 * Public License as published by the Free Software Foundation;
 * either version 2, or (at your option)
 * any later version.
 * 
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 * 
 * ============================================================ */
// TQt
#include <tqstring.h>
#include <tqlineedit.h>
#include <tqpushbutton.h>
#include <tqfileinfo.h>
#include <tqlabel.h>
#include <tqlayout.h>
// KDE
#include <klocale.h>
#include <kbuttonbox.h>
#include <kiconloader.h>
// Local
#include "savefiledialog.h"

namespace KIPIKameraKlientPlugin
{

SavefileDialog::SavefileDialog(const TQString& file, TQWidget *tqparent, const char* name, bool modal) : TQDialog(tqparent, name, modal) {
    TQFileInfo fileInfo(file);
    setCaption(i18n("File Already Exists"));
    TQLabel *descLbl = new TQLabel(i18n("The file '%1' already exists!").tqarg(fileInfo.absFilePath()), this);
    renameEdit = new TQLineEdit(this);
    renameEdit->setText(fileInfo.fileName());
    connect(renameEdit, TQT_SIGNAL(textChanged(const TQString &)), this, TQT_SLOT(slot_renameEnabled()));
    KButtonBox *bbox = new KButtonBox(this);
    renameBtn = bbox->addButton(i18n("Rename"), TQT_TQOBJECT(this), TQT_SLOT(slot_rename()), true);
    renameBtn->setEnabled(false);
    bbox->addButton(i18n("Skip"), TQT_TQOBJECT(this), TQT_SLOT(slot_skip()), false);
    bbox->addButton(i18n("Skip All"), TQT_TQOBJECT(this), TQT_SLOT(slot_skipAll()), true);
    bbox->addButton(i18n("Overwrite"), TQT_TQOBJECT(this), TQT_SLOT(slot_overwrite()), true);
    bbox->addButton(i18n("Overwrite All"), TQT_TQOBJECT(this), TQT_SLOT(slot_overwriteAll()), true);
    TQPushButton *cancelBtn = bbox->addButton(i18n("&Cancel"), TQT_TQOBJECT(this), TQT_SLOT(reject()), true);
    cancelBtn->setDefault(true);
    bbox->tqlayout();
    TQGridLayout *tqlayout = new TQGridLayout(this, 0, 0, 15);
    tqlayout->addMultiCellWidget(descLbl, 0, 0, 0, 3);
    tqlayout->addMultiCellWidget(renameEdit, 3, 3, 0, 3);
    tqlayout->addMultiCellWidget(bbox, 4, 4, 0, 3);
}

SavefileDialog::~SavefileDialog() {
}

SavefileDialog::Operation SavefileDialog::saveFileOperation() {
    return op;
}

TQString SavefileDialog::renameFile() {
    return renameEdit->text();
}

void SavefileDialog::slot_renameEnabled() {
    renameBtn->setEnabled(true);
    renameBtn->setDefault(true);
}

}  // NameSpace KIPIKameraKlientPlugin

#include "savefiledialog.moc"