some improvement concerning multiple tab copies of the same file (MUSR-70)

This commit is contained in:
nemu
2009-06-09 09:06:28 +00:00
parent 025601269b
commit 51e257a276
2 changed files with 25 additions and 2 deletions

View File

@ -73,8 +73,10 @@ bool PFileWatcher::modified()
fFileInfo->refresh(); fFileInfo->refresh();
if (fFileInfo->lastModified() > fLastModified) if (fFileInfo->lastModified() > fLastModified) {
fLastModified = fFileInfo->lastModified();
result = true; result = true;
}
return result; return result;
} }
@ -102,6 +104,7 @@ void PFileWatcher::checkIfModified()
fFileInfo->refresh(); fFileInfo->refresh();
if (fFileInfo->lastModified() > fLastModified) { if (fFileInfo->lastModified() > fLastModified) {
fLastModified = fFileInfo->lastModified();
fTimerCheck->stop(); fTimerCheck->stop();
emit changed(); emit changed();
} }

View File

@ -519,8 +519,28 @@ void PTextEdit::fileOpen()
tr( fAdmin->getDefaultSavePath() ), this); tr( fAdmin->getDefaultSavePath() ), this);
QStringList::Iterator it = flns.begin(); QStringList::Iterator it = flns.begin();
QFileInfo finfo1, finfo2;
QString tabFln;
bool alreadyOpen = false;
while( it != flns.end() ) { while( it != flns.end() ) {
load(*it); // check if the file is not already open
finfo1.setFile(*it);
for (int i=0; i<fTabWidget->count(); i++) {
tabFln = *fFilenames.find( (PSubTextEdit*)fTabWidget->page(i) );
finfo2.setFile(tabFln);
if (finfo1.absFilePath() == finfo2.absFilePath()) {
alreadyOpen = true;
fTabWidget->setCurrentPage(i);
break;
}
}
if (!alreadyOpen)
load(*it);
else
fileReload();
++it; ++it;
} }
} }