blob: 8d4ddfa2f79f1d32f31bda17de9fad4e6acca850 [file] [log] [blame]
Edric Milaretce0ea472016-04-12 10:16:56 -04001/***************************************************************************
2 * Copyright (C) 2016 by Savoir-faire Linux *
3 * Author: Edric Ladent Milaret <edric.ladent-milaret@savoirfairelinux.com>*
4 * *
5 * This program is free software; you can redistribute it and/or modify *
6 * it under the terms of the GNU General Public License as published by *
7 * the Free Software Foundation; either version 3 of the License, or *
8 * (at your option) any later version. *
9 * *
10 * This program is distributed in the hope that it will be useful, *
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of *
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
13 * GNU General Public License for more details. *
14 * *
15 * You should have received a copy of the GNU General Public License *
16 * along with this program. If not, see <http://www.gnu.org/licenses/>. *
17 **************************************************************************/
18
19#include "pathpassworddialog.h"
20#include "ui_pathpassworddialog.h"
21
22#include <QFileDialog>
23
24PathPasswordDialog::PathPasswordDialog(QWidget* parent) :
25 QDialog(parent),
26 ui(new Ui::PathPasswordDialog)
27{
28 ui->setupUi(this);
29
30 Qt::WindowFlags flags = windowFlags();
31 flags = flags & (~Qt::WindowContextHelpButtonHint);
32
33 setWindowFlags(flags);
34}
35
36PathPasswordDialog::~PathPasswordDialog()
37{
38 delete ui;
39}
40
41void
42PathPasswordDialog::on_okButton_clicked()
43{
44 if (not path_.isEmpty() && not password_.isEmpty())
45 accept();
46}
47
48void
49PathPasswordDialog::on_rejectButton_clicked()
50{
51 reject();
52}
53
54void
55PathPasswordDialog::on_pathButtonEdit_clicked()
56{
57 QString filePath;
58 if (exportMode) {
59 filePath = QFileDialog::getSaveFileName(this,
60 tr("Save File"),
61 QString(),
62 tr("Ring archive files (*.ring)"));
63 } else {
64 filePath = QFileDialog::getOpenFileName(this,
65 tr("Open File"),
66 QString(),
67 tr("Ring archive files (*.ring)"));
68 }
69 path_ = QDir::toNativeSeparators(filePath);
70 ui->pathButtonEdit->setText(path_);
71}
72
73void
74PathPasswordDialog::on_passwordLineEdit_textChanged(const QString& password)
75{
76 password_ = password;
77}