Commit 47fe02c1 authored by Marlin Frickenschmidt's avatar Marlin Frickenschmidt

fix bug #341

git-svn-id: http://www.openflipper.org/svnrepo/OpenFlipper/branches/Free@10682 383ad7c9-94d9-4d36-a494-682f7c89f535
parent d01d2c60
...@@ -261,7 +261,7 @@ void Core::saveAllObjects(){ ...@@ -261,7 +261,7 @@ void Core::saveAllObjects(){
for ( PluginFunctions::ObjectIterator o_it(PluginFunctions::TARGET_OBJECTS) ; for ( PluginFunctions::ObjectIterator o_it(PluginFunctions::TARGET_OBJECTS) ;
o_it != PluginFunctions::objectsEnd(); ++o_it) { o_it != PluginFunctions::objectsEnd(); ++o_it) {
if ( !QDir(o_it->path()).exists() || o_it->path().trimmed() == "" ) // if path isn't valid use 'save object to' if ( !QDir(o_it->path()).exists() || o_it->path().trimmed() == "" || o_it->path().trimmed() == "." ) // if path isn't valid use 'save object to'
saveObjectTo(o_it->id(),o_it->name()); saveObjectTo(o_it->id(),o_it->name());
else{ else{
//save (existing files will be overwritten) //save (existing files will be overwritten)
......
...@@ -260,7 +260,7 @@ void LoadWidget::saveFile(){ ...@@ -260,7 +260,7 @@ void LoadWidget::saveFile(){
QStringList files = selectedFiles(); QStringList files = selectedFiles();
if ( files.size() != 1 ) { if ( files.size() != 1 ) {
std::cerr << "Error no or multiple save files selected" << std::endl; std::cerr << "Error: zero or multiple save files selected!" << std::endl;
return; return;
} }
...@@ -339,9 +339,6 @@ int LoadWidget::showLoad(){ ...@@ -339,9 +339,6 @@ int LoadWidget::showLoad(){
/// show Widget for saving Files /// show Widget for saving Files
int LoadWidget::showSave(int _id, QString _filename){ int LoadWidget::showSave(int _id, QString _filename){
std::cerr << "save single file" << std::endl;
setAcceptMode ( QFileDialog::AcceptSave ); setAcceptMode ( QFileDialog::AcceptSave );
setFileMode( QFileDialog::AnyFile ); setFileMode( QFileDialog::AnyFile );
setWindowTitle(tr("Save Object")); setWindowTitle(tr("Save Object"));
...@@ -372,17 +369,9 @@ int LoadWidget::showSave(int _id, QString _filename){ ...@@ -372,17 +369,9 @@ int LoadWidget::showSave(int _id, QString _filename){
//display correct path/name //display correct path/name
QFileInfo fi(_filename); QFileInfo fi(_filename);
QFile file(_filename); QFile file(_filename);
if (file.exists()) { setDirectory(OpenFlipperSettings().value("Core/CurrentDir").toString() );
setDirectory( fi.absolutePath() ); selectFile ( fi.fileName() );
selectFile ( fi.fileName() );
} else {
// setDirectory(OpenFlipper::Options::currentDir().absolutePath() );
std::cout << "setting filename = " << _filename.toStdString() << std::endl;
setDirectory( fi.absolutePath() );
selectFile ( fi.fileName() );
}
//try to select the best fitting name filter //try to select the best fitting name filter
for (int i=0; i < nameFilters().count(); i++){ for (int i=0; i < nameFilters().count(); i++){
...@@ -404,9 +393,6 @@ int LoadWidget::showSave(int _id, QString _filename){ ...@@ -404,9 +393,6 @@ int LoadWidget::showSave(int _id, QString _filename){
/// show Widget for saving Files /// show Widget for saving Files
int LoadWidget::showSave(IdList _ids, QString _filename){ int LoadWidget::showSave(IdList _ids, QString _filename){
std::cerr << "save multiple files" << std::endl;
setAcceptMode ( QFileDialog::AcceptSave ); setAcceptMode ( QFileDialog::AcceptSave );
setFileMode( QFileDialog::AnyFile ); setFileMode( QFileDialog::AnyFile );
setWindowTitle(tr("Save Objects")); setWindowTitle(tr("Save Objects"));
...@@ -443,16 +429,8 @@ int LoadWidget::showSave(IdList _ids, QString _filename){ ...@@ -443,16 +429,8 @@ int LoadWidget::showSave(IdList _ids, QString _filename){
QFileInfo fi(_filename); QFileInfo fi(_filename);
QFile file(_filename); QFile file(_filename);
if (file.exists()) { setDirectory(OpenFlipperSettings().value("Core/CurrentDir").toString() );
setDirectory( fi.absolutePath() ); selectFile ( fi.fileName() );
selectFile ( fi.fileName() );
} else {
// setDirectory(OpenFlipper::Options::currentDir().absolutePath() );
std::cout << "setting filename = " << _filename.toStdString() << std::endl;
setDirectory( fi.absolutePath() );
selectFile ( fi.fileName() );
}
//try to select the best fitting name filter //try to select the best fitting name filter
for (int i=0; i < nameFilters().count(); i++){ for (int i=0; i < nameFilters().count(); i++){
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment