-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathbackupplan.cpp
More file actions
75 lines (66 loc) · 2.22 KB
/
Copy pathbackupplan.cpp
File metadata and controls
75 lines (66 loc) · 2.22 KB
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
#include "backupplan.h"
#include "editsourcesdlg.h"
#include <QMessageBox>
#include <QFileDialog>
#include <QLineEdit>
#include <QVBoxLayout>
#include "basedlg.h"
#include "widgetsettings.h"
#include "pushbutton.h"
BackupPlan::BackupPlan(QObject *parent) :
QObject(parent)
{
}
BackupPlan *BackupPlan::fromWizard()
{
BackupPlan *newPlan = new BackupPlan();
QString name;
while (name.length() == 0)
{
BaseDlg nameDlg(NULL, tr("Name Your Backup Schedule"));
nameDlg.setLayout(new QVBoxLayout());
((QVBoxLayout*)nameDlg.layout())->addSpacerItem(new QSpacerItem(0, 0, QSizePolicy::Ignored, QSizePolicy::Expanding));
nameDlg.layout()->addWidget(WidgetSettings::newHelpLabel(tr("Enter a name for your new backup schedule:")));
QLineEdit *nameEdit = new QLineEdit();
nameEdit->setText(tr("My Backup"));
nameDlg.layout()->addWidget(nameEdit);
PushButton *nextButton = new PushButton(NULL, NULL);
nextButton->setText(tr("Continue"));
nextButton->setSVG(":/continue");
connect(nextButton, SIGNAL(clicked()), &nameDlg, SLOT(accept()));
QHBoxLayout *buttonLayout = new QHBoxLayout();
buttonLayout->addSpacerItem(new QSpacerItem(0, 0, QSizePolicy::Expanding, QSizePolicy::Ignored));
buttonLayout->addWidget(nextButton);
((QVBoxLayout*)nameDlg.layout())->addLayout(buttonLayout);
((QVBoxLayout*)nameDlg.layout())->addSpacerItem(new QSpacerItem(0, 0, QSizePolicy::Ignored, QSizePolicy::Expanding));
nameDlg.show();
if (nameDlg.exec() == QDialog::Rejected)
{
delete newPlan;
return NULL;
}
else
{
name = nameEdit->text();
}
}
EditSourcesDlg dlg;
dlg.show();
if (dlg.exec() == QDialog::Rejected)
{
delete newPlan;
return NULL;
}
QString target;
bool cancel = false;
while (target.isEmpty())
{
target = QFileDialog::getExistingDirectory(NULL,
tr("Select a destination directory"),
QDir::homePath());
if (target.isEmpty())
{
}
}
return newPlan;
}