View Issue Details
ID | Project | Category | View Status | Date Submitted | Last Update |
---|---|---|---|---|---|
0005780 | Scribus | Usability | public | 2007-05-30 15:58 | 2009-05-15 16:21 |
Reporter | alexandre | Assigned To | subik | ||
Priority | normal | Severity | minor | Reproducibility | always |
Status | closed | Resolution | fixed | ||
Product Version | 1.3.4cvs | ||||
Fixed in Version | 1.3.5svn | ||||
Summary | 0005780: Scribus doesn't track what documents are already opened | ||||
Description | Scribus doesn't care if a document is already opened and in works or not, which makes it fairly easy to screw up hours of work. Some D-BUS based solution coul'd be helpful here. | ||||
Tags | No tags attached. | ||||
Patch | |||||
|
What does this mean? |
|
Open a document. Start editing it. Open it again -- Scribus won't tell you that iе's already opened and has changed. |
|
Funny. Now it doesn't reopen and already , but unmaximizes that document child window. It it by design? |
|
It does additional opening here (1.3.5svn) but only when the firstly opened doc marked as changed. I suggest to display a warning dialog and reject to reopen the file. Do you agree? |
|
@subik: sounds good to me |
2009-04-08 12:55
|
bug0005780.diff (4,386 bytes)
Index: scribus/newfile.cpp =================================================================== --- scribus/newfile.cpp (revision 13376) +++ scribus/newfile.cpp (working copy) @@ -555,12 +555,12 @@ if (m_onStartup) { m_tabSelected = tabWidget->currentIndex(); - if (m_tabSelected == 1) // new doc from template + if (m_tabSelected == NewDoc::NewFromTemplateTab) // new doc from template { m_selectedFile = QDir::fromNativeSeparators(nftGui->currentDocumentTemplate->file); m_selectedFile = QDir::cleanPath(m_selectedFile); } - else if (m_tabSelected == 2) // open existing doc + else if (m_tabSelected == NewDoc::OpenExistingTab) // open existing doc { #if QT_VERSION >= 0x040300 QStringList files = fileDialog->selectedFiles(); @@ -570,7 +570,7 @@ m_selectedFile = QDir::fromNativeSeparators(fileDialog->selectedFile()); #endif } - else if (m_tabSelected == 3) // open recent doc + else if (m_tabSelected == NewDoc::OpenRecentTab) // open recent doc { if (recentDocListBox->currentItem() != NULL) { @@ -581,7 +581,7 @@ } } else - m_tabSelected = 0; + m_tabSelected = NewDoc::NewDocumentTab; accept(); } Index: scribus/scribus.cpp =================================================================== --- scribus/scribus.cpp (revision 13376) +++ scribus/scribus.cpp (working copy) @@ -1981,7 +1981,7 @@ NewDoc* dia = new NewDoc(this, RecentDocs, true, ScCore->getGuiLanguage(), PrefsManager::instance()->appPrefs.documentTemplatesDir); if (dia->exec()) { - if (dia->tabSelected() == 0) + if (dia->tabSelected() == NewDoc::NewDocumentTab) { int facingPages = dia->choosenLayout(); int firstPage = dia->firstPage->currentIndex(); @@ -2018,7 +2018,7 @@ doc->setModified(false); updateActiveWindowCaption(doc->DocName); } - else if (dia->tabSelected() == 1) + else if (dia->tabSelected() == NewDoc::NewFromTemplateTab) { QString fileName = QDir::cleanPath(dia->selectedFile()); if (!fileName.isEmpty() && loadDoc(fileName)) @@ -2031,7 +2031,7 @@ removeRecent(fileName); } } - else if (dia->tabSelected() == 2) + else if (dia->tabSelected() == NewDoc::OpenExistingTab) { QString fileName = dia->selectedFile(); if (!fileName.isEmpty()) @@ -2041,7 +2041,7 @@ loadDoc(fileName); } } - else + else // NewDoc::OpenRecentTab { QString fileName = dia->selectedFile(); if (!fileName.isEmpty()) @@ -3806,24 +3806,30 @@ ScribusWin* ActWinOld = NULL; if (windows.count() != 0) ActWinOld = ActWin; - bool found = false; - uint id = 0; - QString platfName = QDir::convertSeparators(fileName); - uint windowCount=windows.count(); + + // PV - 5780: Scribus doesn't track what documents are already opened + // The goal of this part of code is to disallow user to open one + // doc multiple times. + QString platfName(QDir::convertSeparators(fileName)); + uint windowCount = windows.count(); for ( uint i = 0; i < windowCount; ++i ) { - if (windows.at(i)->windowTitle() == platfName) + QString docNameUnmodified(windows.at(i)->windowTitle()); + ScribusWin * mx = qobject_cast<ScribusWin*>(windows.at(i)); + if (mx && mx->doc()->isModified() && docNameUnmodified.endsWith("*")) + docNameUnmodified.resize(docNameUnmodified.length() - 1); + + if (docNameUnmodified == platfName) { - found = true; - id = i; - break; + qApp->changeOverrideCursor(QCursor(Qt::ArrowCursor)); + QMessageBox::information(this, tr("Document is already opened"), + tr("This document is already in use." + "You'll be switched into its window now.")); + windowsMenuActivated(i); + return true; } } - if (found) - { - windowsMenuActivated(id); - return true; - } + if (!fileName.isEmpty()) { QString FName = fi.absoluteFilePath(); Index: scribus/newfile.h =================================================================== --- scribus/newfile.h (revision 13376) +++ scribus/newfile.h (working copy) @@ -56,6 +56,15 @@ Q_OBJECT public: + + //! \brief Indexes of the dialog's tabs. + enum { + NewDocumentTab = 0, + NewFromTemplateTab, + OpenExistingTab, + OpenRecentTab + } ActionSelected; + NewDoc( QWidget* parent, const QStringList& recentDocs, bool startUp = false, QString lang = "", QString templateDir = "" ); ~NewDoc() {}; void createNewDocPage(); |
|
note: I'll apply the patch uploaded here when I can reach my home PC with developer's SVN access... |
|
it should be fixed now. Test, please. |
|
Tested, fixed. Thanks. |
Date Modified | Username | Field | Change |
---|---|---|---|
2007-05-30 15:58 | alexandre | New Issue | |
2007-06-03 11:22 | cbradney | Note Added: 0016424 | |
2007-06-03 21:46 | alexandre | Note Added: 0016427 | |
2008-02-06 00:11 | christoph_s | Status | new => confirmed |
2009-03-07 21:31 | alexandre | Note Added: 0021264 | |
2009-03-31 18:06 | subik | Note Added: 0021456 | |
2009-04-05 12:32 | alexandre | Note Added: 0021483 | |
2009-04-08 09:24 | subik | Status | confirmed => assigned |
2009-04-08 09:24 | subik | Assigned To | => subik |
2009-04-08 12:55 | subik | File Added: bug0005780.diff | |
2009-04-08 12:56 | subik | Note Added: 0021508 | |
2009-04-10 19:43 | subik | Note Added: 0021518 | |
2009-04-10 19:43 | subik | Status | assigned => resolved |
2009-04-10 19:43 | subik | Fixed in Version | => 1.3.5svn |
2009-04-10 19:43 | subik | Resolution | open => fixed |
2009-05-15 16:21 | christoph_s | Note Added: 0021739 | |
2009-05-15 16:21 | christoph_s | Status | resolved => closed |