[Kst] branches/work/kst/1.6/kst/src/libkstapp
Andrew Walker
arwalker at sumusltd.com
Tue Oct 9 23:01:08 CEST 2007
SVN commit 723509 by arwalker:
BUG:150309 Change the default graphics file export name to match that of the kst file when a new kst file is opened. Also, select a better default graphics file export name the first time kst is started.
M +12 -1 kst.cpp
M +11 -1 kstgraphfiledialog_i.cpp
M +20 -1 kstquickstartdialog_i.cpp
M +1 -1 kstquickstartdialog_i.h
--- branches/work/kst/1.6/kst/src/libkstapp/kst.cpp #723508:723509
@@ -1068,6 +1068,7 @@
}
opening = true;
+
KURL url;
bool rc = false;
@@ -1083,14 +1084,24 @@
setCaption(doc->title());
if (url.isLocalFile()) {
QFileInfo finfo(in_filename);
- addRecentFile(finfo.absFilePath());
+ QString fileExport;
+
+ fileExport = finfo.absFilePath();
+ addRecentFile(fileExport);
+ if (fileExport.endsWith(QString(".kst"), FALSE)) {
+ fileExport.truncate(fileExport.length() - QString(".kst").length());
+ }
+ graphFileDlg()->setURL(fileExport);
} else {
addRecentFile(url);
}
+
rc = true;
}
+
slotUpdateStatusMsg(i18n("Ready"));
opening = false;
+
return rc;
}
--- branches/work/kst/1.6/kst/src/libkstapp/kstgraphfiledialog_i.cpp #723508:723509
@@ -158,10 +158,20 @@
cfg.setGroup("AutoSaveImages");
- _url = cfg.readEntry("Location", "");
if (_url.isEmpty()) {
+ _url = cfg.readEntry("Location", "");
+ }
+ if (_url.isEmpty()) {
_url = QDir::currentDirPath();
+ if (_url.length() > 0) {
+ if (_url.endsWith("/", FALSE)) {
+ _url += QString("export");
+ } else {
+ _url += QString("/export");
+ }
+ }
}
+
_format = cfg.readEntry("Format", "PNG");
_w = cfg.readNumEntry("XSize", 640);
_h = cfg.readNumEntry("YSize", 480);
--- branches/work/kst/1.6/kst/src/libkstapp/kstquickstartdialog_i.cpp #723508:723509
@@ -34,11 +34,14 @@
_fileName->completionObject()->setDir(QDir::currentDirPath());
_app = KstApp::inst();
_isRecentFile = false;
+ _openFile->setEnabled(false);
+
connect(_startDataWizard, SIGNAL(clicked()), this, SLOT(wizard_I()));
connect(_openFile, SIGNAL(clicked()), this, SLOT(open_I()));
connect(_recentFileList, SIGNAL(highlighted(const QString&)), this, SLOT(changeURL(const QString&)));
connect(_showAtStartup, SIGNAL(clicked()), this, SLOT(updateSettings()));
connect(_fileName, SIGNAL(textChanged(const QString&)), this, SLOT(deselectRecentFile()));
+ connect(_fileName, SIGNAL(textChanged(const QString&)), this, SLOT(fileChanged(const QString&)));
connect(_recentFileList, SIGNAL(selected(const QString&)), this, SLOT(open_I()));
}
@@ -88,10 +91,26 @@
}
+void KstQuickStartDialogI::fileChanged(const QString& name) {
+ QString file;
+
+ file = name;
+ file = file.stripWhiteSpace();
+ if (!file.isEmpty()) {
+ _openFile->setEnabled(true);
+ } else {
+ _openFile->setEnabled(false);
+ }
+}
+
+
void KstQuickStartDialogI::changeURL(const QString& name) {
_fileName->blockSignals(true);
_fileName->setURL(name);
_fileName->blockSignals(false);
+
+ fileChanged(name);
+
_isRecentFile = true;
}
@@ -109,4 +128,4 @@
}
#include "kstquickstartdialog_i.moc"
-// vim: et ts=2 sw=2
+
--- branches/work/kst/1.6/kst/src/libkstapp/kstquickstartdialog_i.h #723508:723509
@@ -35,6 +35,7 @@
private slots:
void wizard_I();
void open_I();
+ void fileChanged(const QString& name);
void changeURL(const QString& name);
void updateSettings();
void deselectRecentFile();
@@ -48,4 +49,3 @@
};
#endif
-// vim: ts=2 sw=2 et
More information about the Kst
mailing list