Changeset View
Changeset View
Standalone View
Standalone View
src/project/projecttab.cpp
| Show All 25 Lines | |||||
| 26 | #include "project.h" | 26 | #include "project.h" | ||
| 27 | #include "projectwidget.h" | 27 | #include "projectwidget.h" | ||
| 28 | #include "tmscanapi.h" | 28 | #include "tmscanapi.h" | ||
| 29 | #include "prefs.h" | 29 | #include "prefs.h" | ||
| 30 | #include "prefs_lokalize.h" | 30 | #include "prefs_lokalize.h" | ||
| 31 | #include "catalog.h" | 31 | #include "catalog.h" | ||
| 32 | #include "lokalize_debug.h" | 32 | #include "lokalize_debug.h" | ||
| 33 | 33 | | |||
| 34 | #include <KLocalizedString> | | |||
| 35 | #include <KActionCategory> | 34 | #include <KActionCategory> | ||
| 36 | #include <KActionCollection> | 35 | #include <KActionCollection> | ||
| 36 | #include <KGuiItem> | ||||
| 37 | #include <KLocalizedString> | ||||
| 38 | #include <KMessageBox> | ||||
| 39 | #include <KProcess> | ||||
| 37 | #include <KStandardAction> | 40 | #include <KStandardAction> | ||
| 41 | #include <KStandardGuiItem> | ||||
| 38 | #include <KXMLGUIFactory> | 42 | #include <KXMLGUIFactory> | ||
| 39 | #include <KProcess> | | |||
| 40 | #include <KMessageBox> | | |||
| 41 | 43 | | |||
| 42 | #include <QLineEdit> | 44 | #include <QLineEdit> | ||
| 43 | #include <QIcon> | 45 | #include <QIcon> | ||
| 44 | #include <QContextMenuEvent> | 46 | #include <QContextMenuEvent> | ||
| 45 | #include <QMenu> | 47 | #include <QMenu> | ||
| 46 | #include <QVBoxLayout> | 48 | #include <QVBoxLayout> | ||
| 47 | #include <QShortcut> | 49 | #include <QShortcut> | ||
| 48 | #include <QSortFilterProxyModel> | 50 | #include <QSortFilterProxyModel> | ||
| ▲ Show 20 Lines • Show All 295 Lines • ▼ Show 20 Line(s) | |||||
| 344 | { | 346 | { | ||
| 345 | searchInFiles(true); | 347 | searchInFiles(true); | ||
| 346 | } | 348 | } | ||
| 347 | 349 | | |||
| 348 | void ProjectTab::openFile() | 350 | void ProjectTab::openFile() | ||
| 349 | { | 351 | { | ||
| 350 | QStringList files = m_browser->selectedItems(); | 352 | QStringList files = m_browser->selectedItems(); | ||
| 351 | int i = files.size(); | 353 | int i = files.size(); | ||
| 354 | | ||||
| 355 | if (i > 50) { | ||||
shubham: i >= 5, other KDE apps, for example Dolphin takes it into account | |||||
shubham: Never mind, it is > 5, | |||||
adrianchavesfernandez: I actually copy-pasted the code from Dolphin :) | |||||
| 356 | QString caption = i18np("You are about to open %1 file", "You are about to open %1 files", i); | ||||
ppeter: I think that is better to add the reason why the warning appears. | |||||
Could you ellaborate? Maybe suggest an alternative text you would like? adrianchavesfernandez: Could you ellaborate? Maybe suggest an alternative text you would like? | |||||
| 357 | QString text = i18n("Opening a large number of files at the same time can make Lokalize unresponsive.") | ||||
| 358 | + QStringLiteral("\n\n") | ||||
| 359 | + i18n("Are you sure you want to open this many files?"); | ||||
| 360 | auto yes = KGuiItem( | ||||
| 361 | i18np("&Open %1 File", "&Open %1 Files", i), | ||||
| 362 | QStringLiteral("document-open") | ||||
| 363 | ); | ||||
| 364 | const int answer = KMessageBox::warningYesNo( | ||||
| 365 | this, text, caption, yes, KStandardGuiItem::cancel() | ||||
| 366 | ); | ||||
| 367 | if (answer != KMessageBox::Yes) { | ||||
| 368 | return; | ||||
| 369 | } | ||||
| 370 | } | ||||
| 371 | | ||||
| 352 | while (--i >= 0) { | 372 | while (--i >= 0) { | ||
| 353 | if (Catalog::extIsSupported(files.at(i))) { | 373 | if (Catalog::extIsSupported(files.at(i))) { | ||
| 354 | emit fileOpenRequested(files.at(i), true); | 374 | emit fileOpenRequested(files.at(i), true); | ||
| 355 | } | 375 | } | ||
| 356 | } | 376 | } | ||
| 357 | } | 377 | } | ||
| 358 | void ProjectTab::findInFiles() | 378 | void ProjectTab::findInFiles() | ||
| 359 | { | 379 | { | ||
| ▲ Show 20 Lines • Show All 107 Lines • Show Last 20 Lines | |||||
i >= 5, other KDE apps, for example Dolphin takes it into account