Changeset ac76a6a753 in tspsg for src
- 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)
- Location:
- src
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
src/defaults.h
re26679937d rac76a6a753 36 36 //! Default for "Automatically resize rows and columns to their contents" 37 37 #define DEF_AUTOSIZE true 38 //! Default for "Remember last used directories" 39 #define DEF_SAVE_LAST_USED true 38 40 /*! 39 41 * \def DEF_USE_NATIVE_DIALOGS -
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); -
src/settingsdialog.cpp
re26679937d rac76a6a753 200 200 201 201 cbAutosize->setChecked(settings->value("Autosize", DEF_AUTOSIZE).toBool()); 202 cbSaveLastUsed->setChecked(settings->value("SaveLastUsed", DEF_SAVE_LAST_USED).toBool()); 202 203 cbUseNativeDialogs->setChecked(settings->value("UseNativeDialogs", DEF_USE_NATIVE_DIALOGS).toBool()); 203 204 #ifdef Q_OS_WIN32 … … 310 311 return; 311 312 } 312 #ifndef HANDHELD 313 settings->setValue("Save Pos", cbSaveState->isChecked());314 #endif // HANDHELD 313 settings->setValue("Autosize", cbAutosize->isChecked()); 314 settings->setValue("SaveLastUsed", cbSaveLastUsed->isChecked()); 315 settings->setValue("UseNativeDialogs", cbUseNativeDialogs->isChecked()); 315 316 #ifdef Q_OS_WIN32 316 317 if (QtWin::isCompositionEnabled()) { … … 323 324 } 324 325 #endif // Q_OS_WIN32 325 settings->setValue("Autosize", cbAutosize->isChecked()); 326 settings->setValue("UseNativeDialogs", cbUseNativeDialogs->isChecked()); 326 #ifndef HANDHELD 327 settings->setValue("SavePos", cbSaveState->isChecked()); 328 #endif // HANDHELD 327 329 328 330 settings->beginGroup("Task");
Note: See TracChangeset
for help on using the changeset viewer.