Changeset View
Changeset View
Standalone View
Standalone View
krusader/Synchronizer/synchronizergui.cpp
Show First 20 Lines • Show All 380 Lines • ▼ Show 20 Line(s) | 138 | { | |||
---|---|---|---|---|---|
381 | syncList->setAutoFillBackground(true); | 381 | syncList->setAutoFillBackground(true); | ||
382 | 382 | | |||
383 | synchronizerGrid->addWidget(syncList, 1, 0); | 383 | synchronizerGrid->addWidget(syncList, 1, 0); | ||
384 | 384 | | |||
385 | synchronizerTabs->addTab(synchronizerTab, i18n("&Synchronizer")); | 385 | synchronizerTabs->addTab(synchronizerTab, i18n("&Synchronizer")); | ||
386 | synchGrid->addWidget(synchronizerTabs, 0, 0); | 386 | synchGrid->addWidget(synchronizerTabs, 0, 0); | ||
387 | 387 | | |||
388 | filterTabs = FilterTabs::addTo(synchronizerTabs, FilterTabs::HasDontSearchIn); | 388 | filterTabs = FilterTabs::addTo(synchronizerTabs, FilterTabs::HasDontSearchIn); | ||
389 | generalFilter = (GeneralFilter *)filterTabs->get("GeneralFilter"); | 389 | generalFilter = dynamic_cast<GeneralFilter *>(filterTabs->get("GeneralFilter")); | ||
390 | generalFilter->searchFor->setEditText(fileFilter->currentText()); | 390 | generalFilter->searchFor->setEditText(fileFilter->currentText()); | ||
391 | generalFilter->searchForCase->setChecked(true); | 391 | generalFilter->searchForCase->setChecked(true); | ||
392 | 392 | | |||
393 | // creating the time shift, equality threshold, hidden files options | 393 | // creating the time shift, equality threshold, hidden files options | ||
394 | 394 | | |||
395 | auto *optionsGroup = new QGroupBox(generalFilter); | 395 | auto *optionsGroup = new QGroupBox(generalFilter); | ||
396 | optionsGroup->setTitle(i18n("&Options")); | 396 | optionsGroup->setTitle(i18n("&Options")); | ||
397 | 397 | | |||
▲ Show 20 Lines • Show All 266 Lines • ▼ Show 20 Line(s) | 641 | { | |||
664 | error = i18n("URL must be the descendant of either the left or the right base URL."); | 664 | error = i18n("URL must be the descendant of either the left or the right base URL."); | ||
665 | } | 665 | } | ||
666 | 666 | | |||
667 | void SynchronizerGUI::doubleClicked(QTreeWidgetItem *itemIn) | 667 | void SynchronizerGUI::doubleClicked(QTreeWidgetItem *itemIn) | ||
668 | { | 668 | { | ||
669 | if (!itemIn) | 669 | if (!itemIn) | ||
670 | return; | 670 | return; | ||
671 | 671 | | |||
672 | auto *syncItem = (SyncViewItem *)itemIn; | 672 | auto *syncItem = dynamic_cast<SyncViewItem *>(itemIn); | ||
673 | SynchronizerFileItem *item = syncItem->synchronizerItemRef(); | 673 | SynchronizerFileItem *item = syncItem->synchronizerItemRef(); | ||
674 | if (item && item->existsInLeft() && item->existsInRight() && !item->isDir()) { | 674 | if (item && item->existsInLeft() && item->existsInRight() && !item->isDir()) { | ||
675 | QString leftDirName = item->leftDirectory().isEmpty() ? "" : item->leftDirectory() + '/'; | 675 | QString leftDirName = item->leftDirectory().isEmpty() ? "" : item->leftDirectory() + '/'; | ||
676 | QString rightDirName = item->rightDirectory().isEmpty() ? "" : item->rightDirectory() + '/'; | 676 | QString rightDirName = item->rightDirectory().isEmpty() ? "" : item->rightDirectory() + '/'; | ||
677 | QUrl leftURL = Synchronizer::fsUrl(synchronizer.leftBaseDirectory() + leftDirName + item->leftName()); | 677 | QUrl leftURL = Synchronizer::fsUrl(synchronizer.leftBaseDirectory() + leftDirName + item->leftName()); | ||
678 | QUrl rightURL = Synchronizer::fsUrl(synchronizer.rightBaseDirectory() + rightDirName + item->rightName()); | 678 | QUrl rightURL = Synchronizer::fsUrl(synchronizer.rightBaseDirectory() + rightDirName + item->rightName()); | ||
679 | 679 | | |||
680 | SLOTS->compareContent(leftURL,rightURL); | 680 | SLOTS->compareContent(leftURL,rightURL); | ||
Show All 19 Lines | |||||
700 | #define INVERT_SELECTION_ID 101 | 700 | #define INVERT_SELECTION_ID 101 | ||
701 | #define SYNCH_WITH_KGET_ID 102 | 701 | #define SYNCH_WITH_KGET_ID 102 | ||
702 | #define COPY_CLPBD_LEFT_ID 103 | 702 | #define COPY_CLPBD_LEFT_ID 103 | ||
703 | #define COPY_CLPBD_RIGHT_ID 104 | 703 | #define COPY_CLPBD_RIGHT_ID 104 | ||
704 | ////////////////////////////////////////////////////////// | 704 | ////////////////////////////////////////////////////////// | ||
705 | if (!itemIn) | 705 | if (!itemIn) | ||
706 | return; | 706 | return; | ||
707 | 707 | | |||
708 | auto *syncItem = (SyncViewItem *)itemIn; | 708 | auto *syncItem = dynamic_cast<SyncViewItem *>(itemIn); | ||
709 | if (syncItem == nullptr) | 709 | if (syncItem == nullptr) | ||
710 | return; | 710 | return; | ||
711 | 711 | | |||
712 | SynchronizerFileItem *item = syncItem->synchronizerItemRef(); | 712 | SynchronizerFileItem *item = syncItem->synchronizerItemRef(); | ||
713 | 713 | | |||
714 | bool isDuplicate = item->existsInLeft() && item->existsInRight(); | 714 | bool isDuplicate = item->existsInLeft() && item->existsInRight(); | ||
715 | bool isDir = item->isDir(); | 715 | bool isDir = item->isDir(); | ||
716 | 716 | | |||
▲ Show 20 Lines • Show All 545 Lines • ▼ Show 20 Line(s) | 1261 | case Qt::Key_F4 : { | |||
1262 | e->accept(); | 1262 | e->accept(); | ||
1263 | syncList->setFocus(); | 1263 | syncList->setFocus(); | ||
1264 | QTreeWidgetItem *listItem = syncList->currentItem(); | 1264 | QTreeWidgetItem *listItem = syncList->currentItem(); | ||
1265 | if (listItem == nullptr) | 1265 | if (listItem == nullptr) | ||
1266 | break; | 1266 | break; | ||
1267 | 1267 | | |||
1268 | bool isedit = e->key() == Qt::Key_F4; | 1268 | bool isedit = e->key() == Qt::Key_F4; | ||
1269 | 1269 | | |||
1270 | SynchronizerFileItem *item = ((SyncViewItem *)listItem)->synchronizerItemRef(); | 1270 | SynchronizerFileItem *item = (dynamic_cast<SyncViewItem *>(listItem))->synchronizerItemRef(); | ||
1271 | QString leftDirName = item->leftDirectory().isEmpty() ? "" : item->leftDirectory() + '/'; | 1271 | QString leftDirName = item->leftDirectory().isEmpty() ? "" : item->leftDirectory() + '/'; | ||
1272 | QString rightDirName = item->rightDirectory().isEmpty() ? "" : item->rightDirectory() + '/'; | 1272 | QString rightDirName = item->rightDirectory().isEmpty() ? "" : item->rightDirectory() + '/'; | ||
1273 | 1273 | | |||
1274 | if (item->isDir()) | 1274 | if (item->isDir()) | ||
1275 | return; | 1275 | return; | ||
1276 | 1276 | | |||
1277 | if (e->modifiers() == Qt::ShiftModifier && item->existsInRight()) { | 1277 | if (e->modifiers() == Qt::ShiftModifier && item->existsInRight()) { | ||
1278 | QUrl rightURL = Synchronizer::fsUrl(synchronizer.rightBaseDirectory() + rightDirName + item->rightName()); | 1278 | QUrl rightURL = Synchronizer::fsUrl(synchronizer.rightBaseDirectory() + rightDirName + item->rightName()); | ||
Show All 37 Lines | |||||
1316 | } | 1316 | } | ||
1317 | 1317 | | |||
1318 | QDialog::keyPressEvent(e); | 1318 | QDialog::keyPressEvent(e); | ||
1319 | } | 1319 | } | ||
1320 | 1320 | | |||
1321 | bool SynchronizerGUI::eventFilter(QObject * /* watched */, QEvent * e) | 1321 | bool SynchronizerGUI::eventFilter(QObject * /* watched */, QEvent * e) | ||
1322 | { | 1322 | { | ||
1323 | if (e->type() == QEvent::KeyPress) { | 1323 | if (e->type() == QEvent::KeyPress) { | ||
1324 | auto* ke = (QKeyEvent*) e; | 1324 | auto* ke = dynamic_cast<QKeyEvent*>( e); | ||
1325 | switch (ke->key()) { | 1325 | switch (ke->key()) { | ||
1326 | case Qt::Key_Down: | 1326 | case Qt::Key_Down: | ||
1327 | case Qt::Key_Left: | 1327 | case Qt::Key_Left: | ||
1328 | case Qt::Key_Right: | 1328 | case Qt::Key_Right: | ||
1329 | case Qt::Key_Up: | 1329 | case Qt::Key_Up: | ||
1330 | case Qt::Key_Delete: | 1330 | case Qt::Key_Delete: | ||
1331 | case Qt::Key_W: { | 1331 | case Qt::Key_W: { | ||
1332 | if (ke->key() == Qt::Key_W) { | 1332 | if (ke->key() == Qt::Key_W) { | ||
Show All 25 Lines | |||||
1358 | } | 1358 | } | ||
1359 | 1359 | | |||
1360 | ke->accept(); | 1360 | ke->accept(); | ||
1361 | 1361 | | |||
1362 | QTreeWidgetItem *listItem = syncList->currentItem(); | 1362 | QTreeWidgetItem *listItem = syncList->currentItem(); | ||
1363 | if (listItem == nullptr) | 1363 | if (listItem == nullptr) | ||
1364 | return true; | 1364 | return true; | ||
1365 | 1365 | | |||
1366 | SynchronizerFileItem *item = ((SyncViewItem *)listItem)->synchronizerItemRef(); | 1366 | SynchronizerFileItem *item = (dynamic_cast<SyncViewItem *>(listItem))->synchronizerItemRef(); | ||
1367 | 1367 | | |||
1368 | bool hasSelected = false; | 1368 | bool hasSelected = false; | ||
1369 | QList<QTreeWidgetItem *> selected = syncList->selectedItems(); | 1369 | QList<QTreeWidgetItem *> selected = syncList->selectedItems(); | ||
1370 | for (int i = 0; i != selected.count(); i++) | 1370 | for (int i = 0; i != selected.count(); i++) | ||
1371 | if (selected[ i ]->isSelected() && !selected[ i ]->isHidden()) | 1371 | if (selected[ i ]->isSelected() && !selected[ i ]->isHidden()) | ||
1372 | hasSelected = true; | 1372 | hasSelected = true; | ||
1373 | if (!hasSelected) | 1373 | if (!hasSelected) | ||
1374 | listItem->setSelected(true); | 1374 | listItem->setSelected(true); | ||
▲ Show 20 Lines • Show All 212 Lines • Show Last 20 Lines |