Bug 93314 - Display Document Name of Filename as a caption in the main window
Summary: Display Document Name of Filename as a caption in the main window
Status: RESOLVED FIXED
Alias: None
Product: kvoctrain
Classification: Unmaintained
Component: general (show other bugs)
Version: unspecified
Platform: openSUSE Linux
: NOR wishlist
Target Milestone: ---
Assignee: Peter Hedlund
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2004-11-15 15:19 UTC by Marc Heyvaert
Modified: 2004-11-17 23:08 UTC (History)
0 users

See Also:
Latest Commit:
Version Fixed In:
Sentry Crash Report:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Marc Heyvaert 2004-11-15 15:19:05 UTC
Version:           0.8.1 (using KDE KDE 3.2.1)
Installed from:    SuSE RPMs
OS:                Linux

Currently the caption in the main window contains the 'document title' followed by KVoctrain, the application name. If the document was not explicitely named, the caption contains 'untitled'.

I think it would be a good solution to display the 'document title' if there is one or the file name if the 'document title' was not defined. 'Untitled' should be reserved for new files that were no saved yet.

Marc
Comment 1 Peter Hedlund 2004-11-17 23:08:42 UTC
CVS commit by hedlund: 

Use the filename as window caption if no document title has been specified.
BUG:93314


  M +2 -4      kva_io.cpp   1.45
  M +2 -4      kvt-core/kvd_rh_kvtml.cpp   1.16
  M +11 -10    kvt-core/kvoctraindoc.cpp   1.32


--- kdeedu/kvoctrain/kvoctrain/kvt-core/kvd_rh_kvtml.cpp  #1.15:1.16
@@ -1,6 +1,4 @@
 /***************************************************************************
 
-    $Id$
-
                    read header parts of a kvtml document
 
@@ -69,5 +67,5 @@ bool kvoctrainDoc::loadFromKvtMl (QTextS
 
   list<XmlAttribute>::const_iterator first =  elem.attributes ().begin ();
-  doctitle = i18n("untitled");
+  doctitle = i18n("Untitled");
   while (first != elem.attributes ().end ()) {
 

--- kdeedu/kvoctrain/kvoctrain/kvt-core/kvoctraindoc.cpp  #1.31:1.32
@@ -1,5 +1,4 @@
 /***************************************************************************
 
-    $Id$
 
                    maintain a kvoctrain document
@@ -86,5 +85,5 @@ void kvoctrainDoc::Init ()
   queryorg = "";
   querytrans = "";
-  doc_url.setFileName("");
+  doc_url.setFileName(i18n("Untitled"));
   doctitle = "";
   author = "";
@@ -95,4 +94,5 @@ kvoctrainDoc::kvoctrainDoc(QObject *pare
 {
   Init();
+  if (!url.isEmpty())
   doc_url = url;
 
@@ -106,5 +106,4 @@ kvoctrainDoc::kvoctrainDoc(QObject *pare
     {
       KMessageBox::error(0, i18n("<qt>Cannot open file<br><b>%1</b></qt>").arg(url.path()));
-      doc_url.setFileName("unknown.kvtml");
       return;
     }
@@ -187,9 +186,8 @@ bool kvoctrainDoc::saveAs (QObject *pare
 
   KURL tmp (url);
-  if (tmp.isEmpty())
-    tmp = doc_url;
-
-  if (tmp.isEmpty())
-    tmp.setFileName("unknown.kvtml");
+  if (title == i18n("Untitled"))
+    title = QString::null;
+  if (title == doc_url.fileName())
+    title = QString::null;
 
   if (ft == automatic) 
@@ -776,4 +774,7 @@ void kvoctrainDoc::setLessonsInQuery(vec
 QString kvoctrainDoc::getTitle() const
 {
+  if (doctitle.isEmpty())
+    return doc_url.fileName();
+  else
   return doctitle;
 }

--- kdeedu/kvoctrain/kvoctrain/kva_io.cpp  #1.44:1.45
@@ -1,6 +1,4 @@
 /***************************************************************************
 
-    $Id$
-
                          i/o part of kvoctrain
 
@@ -188,5 +186,5 @@ void kvoctrainApp::slotFileNew()
     delete doc;
     QString name = "";
-    doc = new kvoctrainDoc (this, KURL(name), separator, &paste_order);
+    doc = new kvoctrainDoc (this, 0 /*KURL(name)*/, separator, &paste_order);
     loadDocProps(doc);
     if (doc->numLangs() == 0) {
@@ -513,5 +511,5 @@ void kvoctrainApp::slotFileSave()
     commitEntryDlg(false);
 
-  if (doc->URL().isEmpty() ) {
+  if (doc->URL().fileName() == i18n("Untitled") ) {
     slotFileSaveAs();
     return;