Changeset View
Changeset View
Standalone View
Standalone View
krusader/Synchronizer/synchronizer.cpp
Show First 20 Lines • Show All 926 Lines • ▼ Show 20 Line(s) | 920 | { | |||
---|---|---|---|---|---|
927 | 927 | | |||
928 | QUrl leftURL = Synchronizer::fsUrl(leftBaseDir + leftDirName + task->leftName()); | 928 | QUrl leftURL = Synchronizer::fsUrl(leftBaseDir + leftDirName + task->leftName()); | ||
929 | QUrl rightURL = Synchronizer::fsUrl(rightBaseDir + rightDirName + task->rightName()); | 929 | QUrl rightURL = Synchronizer::fsUrl(rightBaseDir + rightDirName + task->rightName()); | ||
930 | 930 | | |||
931 | switch (task->task()) { | 931 | switch (task->task()) { | ||
932 | case TT_COPY_TO_LEFT: | 932 | case TT_COPY_TO_LEFT: | ||
933 | if (task->isDir()) { | 933 | if (task->isDir()) { | ||
934 | KIO::SimpleJob *job = KIO::mkdir(leftURL); | 934 | KIO::SimpleJob *job = KIO::mkdir(leftURL); | ||
935 | connect(job, SIGNAL(result(KJob*)), this, SLOT(slotTaskFinished(KJob*))); | 935 | connect(job, &KIO::MkdirJob::result, this, &Synchronizer::slotTaskFinished); | ||
936 | jobMap[ job ] = task; | 936 | jobMap[ job ] = task; | ||
937 | disableNewTasks = true; | 937 | disableNewTasks = true; | ||
938 | } else { | 938 | } else { | ||
939 | QUrl destURL(leftURL); | 939 | QUrl destURL(leftURL); | ||
940 | if (!task->destination().isNull()) | 940 | if (!task->destination().isNull()) | ||
941 | destURL = Synchronizer::fsUrl(task->destination()); | 941 | destURL = Synchronizer::fsUrl(task->destination()); | ||
942 | 942 | | |||
943 | if (task->rightLink().isNull()) { | 943 | if (task->rightLink().isNull()) { | ||
944 | KIO::FileCopyJob *job = KIO::file_copy(rightURL, destURL, -1, | 944 | KIO::FileCopyJob *job = KIO::file_copy(rightURL, destURL, -1, | ||
945 | ((overWrite || task->overWrite()) ? KIO::Overwrite : KIO::DefaultFlags) | KIO::HideProgressInfo); | 945 | ((overWrite || task->overWrite()) ? KIO::Overwrite : KIO::DefaultFlags) | KIO::HideProgressInfo); | ||
946 | connect(job, SIGNAL(processedSize(KJob*,qulonglong)), this, | 946 | connect(job, SIGNAL(processedSize(KJob*,qulonglong)), this, | ||
947 | SLOT(slotProcessedSize(KJob*,qulonglong))); | 947 | SLOT(slotProcessedSize(KJob*,qulonglong))); | ||
948 | connect(job, SIGNAL(result(KJob*)), this, SLOT(slotTaskFinished(KJob*))); | 948 | connect(job, &KIO::FileCopyJob::result, this, &Synchronizer::slotTaskFinished); | ||
949 | jobMap[ job ] = task; | 949 | jobMap[ job ] = task; | ||
950 | } else { | 950 | } else { | ||
951 | KIO::SimpleJob *job = KIO::symlink(task->rightLink(), destURL, | 951 | KIO::SimpleJob *job = KIO::symlink(task->rightLink(), destURL, | ||
952 | ((overWrite || task->overWrite()) ? KIO::Overwrite : KIO::DefaultFlags) | KIO::HideProgressInfo); | 952 | ((overWrite || task->overWrite()) ? KIO::Overwrite : KIO::DefaultFlags) | KIO::HideProgressInfo); | ||
953 | connect(job, SIGNAL(result(KJob*)), this, SLOT(slotTaskFinished(KJob*))); | 953 | connect(job, &KIO::SimpleJob::result, this, &Synchronizer::slotTaskFinished); | ||
954 | jobMap[ job ] = task; | 954 | jobMap[ job ] = task; | ||
955 | } | 955 | } | ||
956 | } | 956 | } | ||
957 | break; | 957 | break; | ||
958 | case TT_COPY_TO_RIGHT: | 958 | case TT_COPY_TO_RIGHT: | ||
959 | if (task->isDir()) { | 959 | if (task->isDir()) { | ||
960 | KIO::SimpleJob *job = KIO::mkdir(rightURL); | 960 | KIO::SimpleJob *job = KIO::mkdir(rightURL); | ||
961 | connect(job, SIGNAL(result(KJob*)), this, SLOT(slotTaskFinished(KJob*))); | 961 | connect(job, &KIO::SimpleJob::result, this, &Synchronizer::slotTaskFinished); | ||
962 | jobMap[ job ] = task; | 962 | jobMap[ job ] = task; | ||
963 | disableNewTasks = true; | 963 | disableNewTasks = true; | ||
964 | } else { | 964 | } else { | ||
965 | QUrl destURL(rightURL); | 965 | QUrl destURL(rightURL); | ||
966 | if (!task->destination().isNull()) | 966 | if (!task->destination().isNull()) | ||
967 | destURL = Synchronizer::fsUrl(task->destination()); | 967 | destURL = Synchronizer::fsUrl(task->destination()); | ||
968 | 968 | | |||
969 | if (task->leftLink().isNull()) { | 969 | if (task->leftLink().isNull()) { | ||
970 | KIO::FileCopyJob *job = KIO::file_copy(leftURL, destURL, -1, | 970 | KIO::FileCopyJob *job = KIO::file_copy(leftURL, destURL, -1, | ||
971 | ((overWrite || task->overWrite()) ? KIO::Overwrite : KIO::DefaultFlags) | KIO::HideProgressInfo); | 971 | ((overWrite || task->overWrite()) ? KIO::Overwrite : KIO::DefaultFlags) | KIO::HideProgressInfo); | ||
972 | connect(job, SIGNAL(processedSize(KJob*,qulonglong)), this, | 972 | connect(job, SIGNAL(processedSize(KJob*,qulonglong)), this, | ||
973 | SLOT(slotProcessedSize(KJob*,qulonglong))); | 973 | SLOT(slotProcessedSize(KJob*,qulonglong))); | ||
974 | connect(job, SIGNAL(result(KJob*)), this, SLOT(slotTaskFinished(KJob*))); | 974 | connect(job, &KIO::FileCopyJob::result, this, &Synchronizer::slotTaskFinished); | ||
975 | jobMap[ job ] = task; | 975 | jobMap[ job ] = task; | ||
976 | } else { | 976 | } else { | ||
977 | KIO::SimpleJob *job = KIO::symlink(task->leftLink(), destURL, | 977 | KIO::SimpleJob *job = KIO::symlink(task->leftLink(), destURL, | ||
978 | ((overWrite || task->overWrite()) ? KIO::Overwrite : KIO::DefaultFlags) | KIO::HideProgressInfo); | 978 | ((overWrite || task->overWrite()) ? KIO::Overwrite : KIO::DefaultFlags) | KIO::HideProgressInfo); | ||
979 | connect(job, SIGNAL(result(KJob*)), this, SLOT(slotTaskFinished(KJob*))); | 979 | connect(job, &KIO::SimpleJob::result, this, &Synchronizer::slotTaskFinished); | ||
980 | jobMap[ job ] = task; | 980 | jobMap[ job ] = task; | ||
981 | } | 981 | } | ||
982 | } | 982 | } | ||
983 | break; | 983 | break; | ||
984 | case TT_DELETE: { | 984 | case TT_DELETE: { | ||
985 | KIO::DeleteJob *job = KIO::del(leftURL, KIO::DefaultFlags); | 985 | KIO::DeleteJob *job = KIO::del(leftURL, KIO::DefaultFlags); | ||
986 | connect(job, SIGNAL(result(KJob*)), this, SLOT(slotTaskFinished(KJob*))); | 986 | connect(job, &KIO::DeleteJob::result, this, &Synchronizer::slotTaskFinished); | ||
987 | jobMap[ job ] = task; | 987 | jobMap[ job ] = task; | ||
988 | } | 988 | } | ||
989 | break; | 989 | break; | ||
990 | default: | 990 | default: | ||
991 | break; | 991 | break; | ||
992 | } | 992 | } | ||
993 | } | 993 | } | ||
994 | 994 | | |||
▲ Show 20 Lines • Show All 295 Lines • ▼ Show 20 Line(s) | 1278 | { | |||
1290 | 1290 | | |||
1291 | QDialogButtonBox *buttonBox = new QDialogButtonBox(QDialogButtonBox::Cancel); | 1291 | QDialogButtonBox *buttonBox = new QDialogButtonBox(QDialogButtonBox::Cancel); | ||
1292 | mainLayout->addWidget(buttonBox); | 1292 | mainLayout->addWidget(buttonBox); | ||
1293 | 1293 | | |||
1294 | mPauseButton = new QPushButton(i18n("Pause")); | 1294 | mPauseButton = new QPushButton(i18n("Pause")); | ||
1295 | buttonBox->addButton(mPauseButton, QDialogButtonBox::ActionRole); | 1295 | buttonBox->addButton(mPauseButton, QDialogButtonBox::ActionRole); | ||
1296 | buttonBox->button(QDialogButtonBox::Cancel)->setDefault(true); | 1296 | buttonBox->button(QDialogButtonBox::Cancel)->setDefault(true); | ||
1297 | 1297 | | |||
1298 | connect(mPauseButton, SIGNAL(clicked()), SLOT(slotPause())); | 1298 | connect(mPauseButton, &QPushButton::clicked, this, &KgetProgressDialog::slotPause); | ||
1299 | connect(buttonBox, SIGNAL(rejected()), this, SLOT(slotCancel())); | 1299 | connect(buttonBox, &QDialogButtonBox::rejected, this, &KgetProgressDialog::slotCancel); | ||
1300 | 1300 | | |||
1301 | mCancelled = mPaused = false; | 1301 | mCancelled = mPaused = false; | ||
1302 | } | 1302 | } | ||
1303 | 1303 | | |||
1304 | void KgetProgressDialog::slotPause() | 1304 | void KgetProgressDialog::slotPause() | ||
1305 | { | 1305 | { | ||
1306 | if ((mPaused = !mPaused) == false) | 1306 | if ((mPaused = !mPaused) == false) | ||
1307 | mPauseButton->setText(i18n("Pause")); | 1307 | mPauseButton->setText(i18n("Pause")); | ||
▲ Show 20 Lines • Show All 136 Lines • Show Last 20 Lines |