[office/tellico/4.2] /: Default to .tc file suffix when saving

Robby Stephenson <[email protected]>
Newsgroups gmane.comp.kde.cvs
Message-ID <[email protected]>
Git commit 39507e0e846e4fed356b345e0e16da3d099b5594 by Robby Stephenson.
Committed on 19/08/2026 at 12:25.
Pushed by rstephenson into branch '4.2'.

Default to .tc file suffix when saving

M  +4    -0    ChangeLog
M  +8    -1    src/mainwindow.cpp

https://invent.kde.org/office/tellico/-/commit/39507e0e846e4fed356b345e0e16da3d099b5594

diff --git a/ChangeLog b/ChangeLog
index 6823f2c47..9ec726ac3 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,7 @@
+2026-08-18  Robby Stephenson  <[email protected]>
+
+	* Updated to add default file suffix when saving with none.
+
 2026-08-16  Robby Stephenson  <[email protected]>
 
 	* Moved gradient images to data url in entry template.
diff --git a/src/mainwindow.cpp b/src/mainwindow.cpp
index c37417765..372d69d49 100644
--- a/src/mainwindow.cpp
+++ b/src/mainwindow.cpp
@@ -1417,12 +1417,19 @@ bool MainWindow::fileSaveAs() {
   // keyword 'open'
   QString fileClass;
   const QUrl startUrl = KFileWidget::getStartUrl(QUrl(QStringLiteral("kfiledialog:///open")), fileClass);
-  const QUrl url = QFileDialog::getSaveFileUrl(this, i18n("Save As"), startUrl, filter);
+  QUrl url = QFileDialog::getSaveFileUrl(this, i18n("Save As"), startUrl, filter);
 
   if(url.isEmpty()) {
     StatusBar::self()->clearStatus();
     return false;
   }
+  // always add the file extension, too many reports of users being confused
+  // since the file open dialog defaults to looking for .tc
+  const QString fileName = url.fileName();
+  if(!fileName.isEmpty() && fileName.lastIndexOf(QLatin1Char('.')) == -1) {
+    myLog() << "Adding default file extension (.tc) to save file";
+    url.setPath(url.path() + QLatin1String(".tc"));
+  }
   if(url.isLocalFile()) {
     KRecentDirs::add(fileClass, url.adjusted(QUrl::RemoveFilename|QUrl::StripTrailingSlash).path());
   }
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.