#include <QHBoxLayout>
#include <QChar>
+#include "dialog.h"
+
#include <math.h>
#include <errno.h>
#include <iostream>
const QString &fileName,
const bool dirOverDir)
{
- QMessageBox msgBox;
- msgBox.addButton(QMessageBox::Cancel);
- QAbstractButton *yesButton = msgBox.addButton(QMessageBox::Yes);
- QAbstractButton *yesToAllButton = msgBox.addButton(QMessageBox::YesToAll);
- QAbstractButton *noButton = msgBox.addButton(QMessageBox::No);
- QAbstractButton *noToAllButton = msgBox.addButton(QMessageBox::NoToAll);
- QAbstractButton *abortButton = msgBox.addButton(tr("Abort"), QMessageBox::DestructiveRole);
+ Dialog msgBox;
+ msgBox.addButtonFirst(QDialogButtonBox::Cancel);
+ QAbstractButton *yesButton = msgBox.addButtonFirst(QDialogButtonBox::Yes);
+ QAbstractButton *yesToAllButton = msgBox.addButtonFirst(QDialogButtonBox::YesToAll);
+ QAbstractButton *noButton = msgBox.addButtonSecond(QDialogButtonBox::No);
+ QAbstractButton *noToAllButton = msgBox.addButtonSecond(QDialogButtonBox::NoToAll);
+ QAbstractButton *abortButton = msgBox.addButtonSecond(tr("Abort"), QDialogButtonBox::DestructiveRole);
QAbstractButton *askButton = 0;
QAbstractButton *skipDirButton = 0;
if (dirOverDir) {
msgBox.setText(tr("Directory %1 already exists. Overwrite the files inside?")
.arg(FileOperator::shortenPath(fileName)));
- askButton = msgBox.addButton(tr("Ask"), QMessageBox::AcceptRole);
- skipDirButton = msgBox.addButton(tr("Skip"), QMessageBox::NoRole);
+ askButton = msgBox.addButtonFirst(tr("Ask"), QDialogButtonBox::AcceptRole);
+ skipDirButton = msgBox.addButtonSecond(tr("Skip"), QDialogButtonBox::NoRole);
} else {
msgBox.setText(tr("File %1 already exists. Overwrite?").arg(FileOperator::shortenPath(fileName)));
}
msgBox.exec();
- if (msgBox.clickedButton() == abortButton) {
+ if (msgBox.clickedButton == abortButton) {
manipulator->setResponse(ABORT);
- } else if (msgBox.clickedButton() == yesButton) {
+ } else if (msgBox.clickedButton == yesButton) {
manipulator->setResponse(OVERWRITE);
- } else if (msgBox.clickedButton() == yesToAllButton) {
+ } else if (msgBox.clickedButton == yesToAllButton) {
manipulator->setResponse(OVERWRITE, true);
- } else if (msgBox.clickedButton() == noButton) {
+ } else if (msgBox.clickedButton == noButton) {
manipulator->setResponse(KEEP);
- } else if (msgBox.clickedButton() == noToAllButton) {
+ } else if (msgBox.clickedButton == noToAllButton) {
manipulator->setResponse(KEEP, true);
- } else if (msgBox.clickedButton() == askButton) {
+ } else if (msgBox.clickedButton == askButton) {
manipulator->setResponse(NONE, true);
- } else if (msgBox.clickedButton() == skipDirButton) {
+ } else if (msgBox.clickedButton == skipDirButton) {
manipulator->setResponse(SKIP_DIR);
}
}
FileManipulatorThread::~FileManipulatorThread() {
- if (progressBar->value() < progressBar->maximum()) {
+ if (!abort && progressBar->value() < progressBar->maximum()) {
std::cout << "WARNING: deleting a progressbar which's value " << progressBar->value() <<
" has not reached maximum of " << progressBar->maximum() << std::endl;
}