Save/restore file paths as relative to project file.
This commit is contained in:
+2
-6
@@ -111,8 +111,6 @@ namespace glabels
|
||||
model::Model *model = model::XmlLabelParser::readFile( fileName );
|
||||
if ( model )
|
||||
{
|
||||
model->setFileName( fileName );
|
||||
|
||||
// Either apply to current window or open a new one
|
||||
if ( window->isEmpty() )
|
||||
{
|
||||
@@ -156,7 +154,6 @@ namespace glabels
|
||||
}
|
||||
|
||||
model::XmlLabelCreator::writeFile( window->model(), window->model()->fileName() );
|
||||
window->model()->clearModified();
|
||||
|
||||
// Save CWD
|
||||
mCwd = QFileInfo( window->model()->fileName() ).absolutePath();
|
||||
@@ -170,7 +167,8 @@ namespace glabels
|
||||
///
|
||||
bool File::saveAs( MainWindow *window )
|
||||
{
|
||||
// Either use the saved CWD from a previous open/save or grab it from the path of the current file
|
||||
// Either use the saved CWD from a previous open/save or grab it from the path
|
||||
// of the current file.
|
||||
QString cwd = mCwd;
|
||||
if ( window->model() && !window->model()->fileName().isEmpty() )
|
||||
{
|
||||
@@ -210,8 +208,6 @@ namespace glabels
|
||||
}
|
||||
|
||||
model::XmlLabelCreator::writeFile( window->model(), fileName );
|
||||
window->model()->setFileName( fileName );
|
||||
window->model()->clearModified();
|
||||
|
||||
// Save CWD
|
||||
mCwd = QFileInfo( fileName ).absolutePath();
|
||||
|
||||
@@ -63,7 +63,7 @@ namespace glabels
|
||||
mUndoRedoModel = undoRedoModel;
|
||||
|
||||
// Initialize CWD
|
||||
mCwd = mModel->dir();
|
||||
mCwd = mModel->dirPath();
|
||||
|
||||
onMergeChanged();
|
||||
connect( mModel, SIGNAL(mergeChanged()), this, SLOT(onMergeChanged()) );
|
||||
@@ -93,7 +93,7 @@ namespace glabels
|
||||
|
||||
case merge::Factory::FILE:
|
||||
locationLabel->setEnabled( true );
|
||||
fn = QDir(mModel->dir()).relativeFilePath( mModel->merge()->source() );
|
||||
fn = mModel->dir().relativeFilePath( mModel->merge()->source() );
|
||||
locationLineEdit->setText( fn );
|
||||
locationBrowseButton->setVisible( true );
|
||||
break;
|
||||
@@ -124,7 +124,7 @@ namespace glabels
|
||||
///
|
||||
void MergeView::onMergeSourceChanged()
|
||||
{
|
||||
QString fn = QDir(mModel->dir()).relativeFilePath( mModel->merge()->source() );
|
||||
QString fn = mModel->dir().relativeFilePath( mModel->merge()->source() );
|
||||
locationLineEdit->setText( fn );
|
||||
|
||||
recordsTable->clear();
|
||||
|
||||
@@ -130,7 +130,7 @@ namespace glabels
|
||||
}
|
||||
else
|
||||
{
|
||||
QString fn = QDir(mModel->dir()).relativeFilePath( filenameNode.data() );
|
||||
QString fn = mModel->dir().relativeFilePath( filenameNode.data() );
|
||||
imageFilenameLineEdit->setText( fn );
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user