4
4
//===============================================================================================================================
5
5
//===============================================================================================================================
6
6
// This file is part of "luckyBackup" project
7
// Copyright 2008-2009, Loukas Avgeriou
7
// Copyright 2008-2010, Loukas Avgeriou
8
8
// luckyBackup is distributed under the terms of the GNU General Public License
9
9
// luckyBackup is free software: you can redistribute it and/or modify
10
10
// it under the terms of the GNU General Public License as published by
23
23
// project version : Please see "main.cpp" for project version
25
25
// developer : luckyb
26
// last modified : 12 Dec 2009
26
// last modified : 16 Apr 2010
27
27
//===============================================================================================================================
28
28
//===============================================================================================================================
82
83
uiT.label_message -> setText(tr("You have selected to \"Backup the contents of the source directory\"<br>together with the \"delete files on the destination\" option") +"<br><br>" + tr("BEWARE, if your intention is NOT to clone source to destination !!") +"<br><br>" +
83
84
tr("Are you sure you wish to proceed ??") + "<br><br>");
86
if (type == "ValidateDialog")
88
uiT.lineEdit_userInput -> setVisible(FALSE);
89
uiT.label_warning -> setVisible(TRUE);
90
uiT.label_warning -> setPixmap(QPixmap(":/luckyPrefix/validate.png"));
91
uiT.pushButton_cancel -> setText(tr("Copy command to clipboard"));
92
uiT.pushButton_cancel -> setIcon(QIcon(":/luckyPrefix/copy.png"));
93
uiT.label_message -> setText(ReplaceInput);
95
if (type == "ViewCurrentCrontab")
97
this -> resize(640, 480);
98
uiT.lineEdit_userInput -> setVisible(FALSE);
99
uiT.pushButton_cancel -> setVisible(FALSE);
100
uiT.label_message -> setText(ReplaceInput);
86
103
// SLOTS-------------------------------------------------------------------------------------
87
104
// --------------------------------okay pressed------------------------------------------------
121
138
void textDialog::cancel()
141
if (Type == "ValidateDialog")
143
QString source, dest, Command_Clipboard;
145
//copy command to clipboard
146
TextPassed = TextPassed.right(TextPassed.size()-TextPassed.indexOf("<font color=red>")); //remove all irrelevant text
147
source = TextPassed.right(TextPassed.size()-TextPassed.indexOf("<font color=magenta>")); //copy source & dest inside QString source
148
TextPassed.remove(source); //remove source & dest from whole command
149
dest = source.right(source.size()-source.lastIndexOf("<font color=magenta>")); //copy dest inside QString dest
150
source.remove(dest); //remove dest from source
152
source.remove("<font color=magenta>",Qt::CaseSensitive);
153
source.remove("</font>",Qt::CaseSensitive);
154
source.remove("<br>",Qt::CaseSensitive);
155
if (source.endsWith(" "))
157
source.replace(" ","\\ "); //replace whitespaces with " \"
159
dest.remove("<font color=magenta>",Qt::CaseSensitive);
160
dest.remove("</font>",Qt::CaseSensitive);
161
dest.remove("<br>",Qt::CaseSensitive);
162
dest.replace(" ","\\ ");
164
Command_Clipboard = TextPassed + source + " " + dest;
165
Command_Clipboard.remove("<font color=red>",Qt::CaseSensitive);
166
Command_Clipboard.remove("<font color=blue>",Qt::CaseSensitive);
167
Command_Clipboard.remove("</font>",Qt::CaseSensitive);
168
Command_Clipboard.remove("<br>",Qt::CaseSensitive);
170
QClipboard *clipboard = QApplication::clipboard();
171
clipboard->setText(Command_Clipboard);
127
177
void textDialog::closeEvent(QCloseEvent *event)