Bug 57654 - saving a new file, defaults to documentdir - better would perhaps be project dir
Summary: saving a new file, defaults to documentdir - better would perhaps be project dir
Status: RESOLVED FIXED
Alias: None
Product: quanta
Classification: Miscellaneous
Component: general (show other bugs)
Version: 3.1.1
Platform: Gentoo Packages Linux
: NOR wishlist
Target Milestone: ---
Assignee: András Manţia
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2003-04-24 18:23 UTC by Thilo Bangert
Modified: 2003-05-10 13:25 UTC (History)
0 users

See Also:
Latest Commit:
Version Fixed In:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Thilo Bangert 2003-04-24 18:23:04 UTC
Version:           3.1.1 (using KDE KDE 3.1.1a)
Installed from:    Gentoo Packages
Compiler:          gcc2.95.3 
OS:          Linux

i have a project. i add a new file and want to save it.

the save dialog then show me my document folder (KDE document folder) - IMHO it would be much better to default to the project folder...

thanks for quanta
best regards
Thilo
Comment 1 András Manţia 2003-05-10 13:25:46 UTC
Subject: quanta

CVS commit by amantia: 

Default to the project dir when saving a new document. Implements #57654.

CCMAIL: 57654-done@bugs.kde.org


  M +2 -0      ChangeLog   1.170
  M +12 -11    quanta/quanta.cpp   1.278
  M +3 -0      quanta/quantadoc.cpp   1.100


--- quanta/ChangeLog  #1.169:1.170
@@ -40,4 +40,5 @@
     - do not truncate the file after a preview
     - fix possible crashes when using plugins
+    - use the project base directory as the working directory for script actions [  #36415]
   - new features:
     - "Replace selection" for script actions replaces the selection if
@@ -89,4 +90,5 @@
     - show detailed descriptions in the special chars combobox
     - restructured editor context menu
+    - default to the project dir when saving a new document [#57654]
   - new DCOP interfaces:
     - WindowManagerIf::projectURL()

--- quanta/quanta/quanta.cpp  #1.277:1.278
@@ -78,4 +78,5 @@
 #if (KDE_VERSION > 308)
 #include <ktexteditor/dynwordwrapinterface.h>
+#include <ktexteditor/encodinginterface.h>
 #endif
 
@@ -227,21 +228,21 @@ bool QuantaApp::slotFileSaveAs()
     w->checkDirtyStatus();
     fileWatcher->stopScan();
-    if (w->kate_view->saveAs() == Kate::View::SAVE_OK)
-    {
-      w->createTempFile();
-
-      KURL url = w->doc()->url();
+    #if KDE_VERSION >= 308
+      QString myEncoding =  dynamic_cast<KTextEditor::EncodingInterface*>(w->doc())->encoding();
+    #else
+      QString myEncoding = w->kate_doc->encoding();
+    #endif
 
+    KateFileDialog dialog(projectBaseURL().path(), myEncoding, this, i18n ("Save File"), KateFileDialog::saveDialog);
+    KateFileDialogData data = dialog.exec();
+    if (m_doc->saveDocument(data.url))
+    {
       if ( ( m_project->hasProject() ) &&
-          ( KMessageBox::Yes == KMessageBox::questionYesNo(0,i18n("Add file\n %1 \n to project ?").arg(url.url())) )
+          ( KMessageBox::Yes == KMessageBox::questionYesNo(0,i18n("Add file\n %1 \n to project ?").arg(data.url.prettyURL())) )
         )
       {
-        m_project->insertFile(url,true);
+        m_project->insertFile(data.url, true);
       }
 
-      if ( oldURL != url )
-      {
-        m_doc->changeFileTabName();
-      }
       slotUpdateStatus(w);
       result = true;

--- quanta/quanta/quantadoc.cpp  #1.99:1.100
@@ -228,4 +228,7 @@ bool QuantaDoc::saveDocument(const KURL&
       fileWatcher->addFile(w->url().path());
     }
+  } else
+  {
+    result = false;
   }