Changeset View
Changeset View
Standalone View
Standalone View
src/Gui/KSMainWindow.cpp
Show First 20 Lines • Show All 291 Lines • ▼ Show 20 Line(s) | 291 | if (printDialog.exec() == QDialog::Accepted) { | |||
---|---|---|---|---|---|
292 | ExportManager::instance()->doPrint(printer); | 292 | ExportManager::instance()->doPrint(printer); | ||
293 | return; | 293 | return; | ||
294 | } | 294 | } | ||
295 | delete printer; | 295 | delete printer; | ||
296 | } | 296 | } | ||
297 | 297 | | |||
298 | void KSMainWindow::openScreenshotsFolder() | 298 | void KSMainWindow::openScreenshotsFolder() | ||
299 | { | 299 | { | ||
300 | // Highlight last screenshot in file manager if user saved at least once, | 300 | // Highlight last screenshot in file manager if user saved at least once ever | ||
301 | // or open default directory as determined by save button | 301 | // (since last save and saveas file names are stored in spectaclerc), otherwise, | ||
302 | QUrl location = ExportManager::instance()->lastSavePath(); | 302 | // if in save mode, open default save location from configure > save > location | ||
303 | if (!ExportManager::instance()->isFileExists(location)) { | 303 | // if in save as mode, open last save as files location | ||
304 | switch(SpectacleConfig::instance()->lastUsedSaveMode()) { | 304 | // failsafe for either option is default save location from configure > save > location | ||
305 | SpectacleConfig *cfgManager = SpectacleConfig::instance(); | ||||
306 | ExportManager *exportManager = ExportManager::instance(); | ||||
307 | QUrl location; | ||||
308 | | ||||
309 | switch(cfgManager->lastUsedSaveMode()) { | ||||
305 | case SaveMode::Save: | 310 | case SaveMode::Save: | ||
306 | location = QUrl::fromLocalFile(ExportManager::instance()->saveLocation() + QStringLiteral("/")); | 311 | location = cfgManager->lastSaveFile(); | ||
312 | if (!exportManager->isFileExists(location)) { | ||||
313 | location = QUrl(cfgManager->defaultSaveLocation()); | ||||
314 | } | ||||
307 | break; | 315 | break; | ||
308 | case SaveMode::SaveAs: | 316 | case SaveMode::SaveAs: | ||
309 | default: | 317 | location = cfgManager->lastSaveAsFile(); // already has a "/" at the end | ||
310 | location = SpectacleConfig::instance()->lastSaveAsLocation(); // already has a "/" at the end | 318 | if (!exportManager->isFileExists(location)) { | ||
311 | break; | 319 | location = cfgManager->lastSaveAsLocation(); | ||
312 | } | | |||
313 | if (!ExportManager::instance()->isFileExists(location)) { | | |||
314 | location = QUrl(QStandardPaths::writableLocation(QStandardPaths::PicturesLocation) + QStringLiteral("/")); | | |||
315 | } | 320 | } | ||
321 | break; | ||||
316 | } | 322 | } | ||
323 | | ||||
317 | KIO::highlightInFileManager({location}); | 324 | KIO::highlightInFileManager({location}); | ||
318 | } | 325 | } | ||
319 | 326 | | |||
320 | void KSMainWindow::quit(const QuitBehavior quitBehavior) | 327 | void KSMainWindow::quit(const QuitBehavior quitBehavior) | ||
321 | { | 328 | { | ||
322 | qApp->setQuitOnLastWindowClosed(false); | 329 | qApp->setQuitOnLastWindowClosed(false); | ||
323 | hide(); | 330 | hide(); | ||
324 | 331 | | |||
▲ Show 20 Lines • Show All 99 Lines • Show Last 20 Lines |