Changeset ac76a6a753 in tspsg for src/mainwindow.cpp
- Timestamp:
- Sep 2, 2010, 3:48:11 PM (14 years ago)
- Branches:
- 0.1.3.145-beta1-symbian, 0.1.4.170-beta2-bb10, appveyor, imgbot, master, readme
- Children:
- 7cd6da5021
- Parents:
- e26679937d
- git-author:
- Oleksii Serdiuk <contacts@…> (09/02/10 15:48:11)
- git-committer:
- Oleksii Serdiuk <contacts@…> (06/29/12 19:45:57)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
src/mainwindow.cpp
re26679937d rac76a6a753 158 158 filters.append(tr("All Files") + " (*)"); 159 159 160 QString file = QFileInfo(fileName).canonicalPath(); 160 QString file; 161 if ((fileName == tr("Untitled") + ".tspt") && settings->value("SaveLastUsed", DEF_SAVE_LAST_USED).toBool()) 162 file = settings->value("LastUsed/TaskLoadPath").toString(); 163 else 164 file = QFileInfo(fileName).path(); 161 165 QFileDialog::Options opts = settings->value("UseNativeDialogs", DEF_USE_NATIVE_DIALOGS).toBool() ? QFileDialog::Options() : QFileDialog::DontUseNativeDialog; 162 166 file = QFileDialog::getOpenFileName(this, tr("Task Load"), file, filters.join(";;"), NULL, opts); 163 167 if (file.isEmpty() || !QFileInfo(file).isFile()) 164 168 return; 169 if (settings->value("SaveLastUsed", DEF_SAVE_LAST_USED).toBool()) 170 settings->setValue("LastUsed/TaskLoadPath", QFileInfo(file).path()); 171 165 172 if (!tspmodel->loadTask(file)) 166 173 return; … … 174 181 bool MainWindow::actionFileSaveTriggered() 175 182 { 176 if ((fileName == tr("Untitled") + ".tspt") || (!fileName.endsWith(".tspt", Qt::CaseInsensitive)))183 if ((fileName == tr("Untitled") + ".tspt") || !fileName.endsWith(".tspt", Qt::CaseInsensitive)) 177 184 return saveTask(); 178 185 else … … 192 199 { 193 200 static QString selectedFile; 194 if (selectedFile.isEmpty()) 195 selectedFile = QFileInfo(fileName).canonicalPath(); 196 else 197 selectedFile = QFileInfo(selectedFile).canonicalPath(); 201 if (selectedFile.isEmpty()) { 202 if (settings->value("SaveLastUsed", DEF_SAVE_LAST_USED).toBool()) { 203 selectedFile = settings->value("LastUsed/SolutionSavePath").toString(); 204 } 205 } else 206 selectedFile = QFileInfo(selectedFile).path(); 198 207 if (!selectedFile.isEmpty()) 199 selectedFile += "/";208 selectedFile.append("/"); 200 209 if (fileName == tr("Untitled") + ".tspt") { 201 210 #ifndef QT_NO_PRINTER … … 227 236 return; 228 237 selectedFile = file; 238 if (settings->value("SaveLastUsed", DEF_SAVE_LAST_USED).toBool()) 239 settings->setValue("LastUsed/SolutionSavePath", QFileInfo(selectedFile).path()); 229 240 QApplication::setOverrideCursor(QCursor(Qt::WaitCursor)); 230 241 #ifndef QT_NO_PRINTER … … 1432 1443 filters.append(tr("All Files") + " (*)"); 1433 1444 QString file; 1434 if (fileName.endsWith(".tspt", Qt::CaseInsensitive)) 1445 if ((fileName == tr("Untitled") + ".tspt") && settings->value("SaveLastUsed", DEF_SAVE_LAST_USED).toBool()) { 1446 file = settings->value("LastUsed/TaskSavePath").toString(); 1447 if (!file.isEmpty()) 1448 file.append("/"); 1449 file.append(fileName); 1450 } else if (fileName.endsWith(".tspt", Qt::CaseInsensitive)) 1435 1451 file = fileName; 1436 1452 else 1437 file = QFileInfo(fileName). canonicalPath() + "/" + QFileInfo(fileName).completeBaseName() + ".tspt";1453 file = QFileInfo(fileName).path() + "/" + QFileInfo(fileName).completeBaseName() + ".tspt"; 1438 1454 1439 1455 QFileDialog::Options opts = settings->value("UseNativeDialogs", DEF_USE_NATIVE_DIALOGS).toBool() ? QFileDialog::Options() : QFileDialog::DontUseNativeDialog; 1440 1456 file = QFileDialog::getSaveFileName(this, tr("Task Save"), file, filters.join(";;"), NULL, opts); 1441 1442 1457 if (file.isEmpty()) 1443 1458 return false; 1459 else if (settings->value("SaveLastUsed", DEF_SAVE_LAST_USED).toBool()) 1460 settings->setValue("LastUsed/TaskSavePath", QFileInfo(file).path()); 1461 1444 1462 if (tspmodel->saveTask(file)) { 1445 1463 setFileName(file);
Note: See TracChangeset
for help on using the changeset viewer.