r15526 by fschmid - Scrapbook directorys are now under supervision by the filewatcher
scribus-commit
scribus-commit at lists.scribus.net
Mon Oct 11 23:37:44 CEST 2010
Author: fschmid
Date: Mon Oct 11 21:37:44 2010
New Revision: 15526
URL: http://scribus.info/websvn/listing.php?repname=Scribus&sc=1&rev=15526
Log:
Scrapbook directorys are now under supervision by the filewatcher
Modified:
trunk/Scribus/scribus/scribus.cpp
trunk/Scribus/scribus/ui/scrapbookpalette.cpp
trunk/Scribus/scribus/ui/scrapbookpalette.h
Modified: trunk/Scribus/scribus/scribus.cpp
URL: http://scribus.info/websvn/diff.php?repname=Scribus&rev=15526&path=/trunk/Scribus/scribus/scribus.cpp
==============================================================================
--- trunk/Scribus/scribus/scribus.cpp (original)
+++ trunk/Scribus/scribus/scribus.cpp Mon Oct 11 21:37:44 2010
@@ -602,9 +602,11 @@
if (scrapbookFileInfo.exists())
scrapbookPalette->readContents(scrapbookFile);
scrapbookPalette->setScrapbookFileName(scrapbookFile);
+ ScCore->fileWatcher->addDir(scrapbookFile);
scrapbookPalette->setOpenScrapbooks(prefsManager->appPrefs.scrapbookPrefs.RecentScrapbooks);
rebuildRecentPasteMenu();
connect(scrapbookPalette, SIGNAL(updateRecentMenue()), this, SLOT(rebuildRecentPasteMenu()));
+ connect(ScCore->fileWatcher, SIGNAL(dirChanged(QString )), scrapbookPalette, SLOT(reloadLib(QString )));
}
Modified: trunk/Scribus/scribus/ui/scrapbookpalette.cpp
URL: http://scribus.info/websvn/diff.php?repname=Scribus&rev=15526&path=/trunk/Scribus/scribus/ui/scrapbookpalette.cpp
==============================================================================
--- trunk/Scribus/scribus/ui/scrapbookpalette.cpp (original)
+++ trunk/Scribus/scribus/ui/scrapbookpalette.cpp Mon Oct 11 21:37:44 2010
@@ -35,6 +35,7 @@
#include "commonstrings.h"
#include "cmsettings.h"
+#include "filewatcher.h"
#include "prefsfile.h"
#include "prefsmanager.h"
#include "query.h"
@@ -796,10 +797,10 @@
newButton->setSizePolicy(QSizePolicy(QSizePolicy::Fixed, QSizePolicy::Fixed));
newButton->setIcon(loadIcon("16/document-new.png"));
newButton->setIconSize(QSize(16, 16));
- loadButton = new QToolButton(this);
- loadButton->setSizePolicy(QSizePolicy(QSizePolicy::Fixed, QSizePolicy::Fixed));
- loadButton->setIcon(loadIcon("16/document-open.png"));
- loadButton->setIconSize(QSize(16, 16));
+// loadButton = new QToolButton(this);
+// loadButton->setSizePolicy(QSizePolicy(QSizePolicy::Fixed, QSizePolicy::Fixed));
+// loadButton->setIcon(loadIcon("16/document-open.png"));
+// loadButton->setIconSize(QSize(16, 16));
saveAsButton = new QToolButton(this);
saveAsButton->setSizePolicy(QSizePolicy(QSizePolicy::Fixed, QSizePolicy::Fixed));
saveAsButton->setIcon(loadIcon("16/document-save-as.png"));
@@ -813,7 +814,7 @@
closeButton->setIcon(loadIcon("16/close.png"));
closeButton->setIconSize(QSize(16, 16));
buttonLayout->addWidget( newButton );
- buttonLayout->addWidget( loadButton );
+// buttonLayout->addWidget( loadButton );
buttonLayout->addWidget( saveAsButton );
buttonLayout->addWidget( importButton );
buttonLayout->addWidget( closeButton );
@@ -835,7 +836,7 @@
languageChange();
connect(newButton, SIGNAL(clicked()), this, SLOT(NewLib()));
- connect(loadButton, SIGNAL(clicked()), this, SLOT(Load()));
+// connect(loadButton, SIGNAL(clicked()), this, SLOT(Load()));
connect(saveAsButton, SIGNAL(clicked()), this, SLOT(SaveAs()));
connect(importButton, SIGNAL(clicked()), this, SLOT(Import()));
connect(closeButton, SIGNAL(clicked()), this, SLOT(closeLib()));
@@ -866,6 +867,7 @@
activeBView->ReadContents(fileName);
activeBView->ScFilename = fileName;
activeBView->visibleName = d.dirName();
+ ScCore->fileWatcher->addDir(d.absolutePath());
activeBView->scrollToTop();
}
}
@@ -975,6 +977,7 @@
activeBView->ScFilename = fileName;
activeBView->visibleName = d.dirName();
Frame3->setCurrentWidget(activeBView);
+ ScCore->fileWatcher->addDir(d.absolutePath());
d.cdUp();
dirs->set("scrap_load", d.absolutePath());
activeBView->scrollToTop();
@@ -985,7 +988,7 @@
connect(activeBView, SIGNAL(itemDoubleClicked(QListWidgetItem *)), this, SLOT(handleDoubleClick(QListWidgetItem *)));
}
}
-
+/*
void Biblio::Load()
{
PrefsContext* dirs = PrefsManager::instance()->prefsFile->getContext("dirs");
@@ -1016,6 +1019,7 @@
activeBView->ScFilename = fileName;
activeBView->visibleName = d.dirName();
Frame3->setCurrentWidget(activeBView);
+ ScCore->fileWatcher->addDir(d.absolutePath());
d.cdUp();
dirs->set("scrap_load", d.absolutePath());
activeBView->scrollToTop();
@@ -1026,7 +1030,7 @@
connect(activeBView, SIGNAL(itemDoubleClicked(QListWidgetItem *)), this, SLOT(handleDoubleClick(QListWidgetItem *)));
}
}
-
+*/
void Biblio::Import()
{
PrefsContext* dirs = PrefsManager::instance()->prefsFile->getContext("dirs");
@@ -1083,6 +1087,8 @@
disconnect(activeBView, SIGNAL(customContextMenuRequested (const QPoint &)), this, SLOT(HandleMouse(QPoint)));
disconnect(activeBView, SIGNAL(itemDoubleClicked(QListWidgetItem *)), this, SLOT(handleDoubleClick(QListWidgetItem *)));
disconnect(Frame3, SIGNAL(currentChanged(int)), this, SLOT(libChanged(int )));
+ QFileInfo fi(activeBView->ScFilename);
+ ScCore->fileWatcher->removeDir(fi.absolutePath());
Frame3->removeItem(Frame3->indexOf(activeBView));
delete activeBView; // currently disabled as the whole TabWidget vanishes when executing that delete????? -> seems to be fixed in Qt-4.3.3
activeBView = (BibView*)Frame3->widget(0);
@@ -1106,6 +1112,22 @@
connect(activeBView, SIGNAL(fileDropped(QString, int)), this, SLOT(ObjFromFile(QString, int)));
connect(activeBView, SIGNAL(customContextMenuRequested (const QPoint &)), this, SLOT(HandleMouse(QPoint)));
connect(activeBView, SIGNAL(itemDoubleClicked(QListWidgetItem *)), this, SLOT(handleDoubleClick(QListWidgetItem *)));
+}
+
+void Biblio::reloadLib(QString fileName)
+{
+ for (int a = 0; a < Frame3->count(); a++)
+ {
+ BibView* bv = (BibView*)Frame3->widget(a);
+ if (bv->ScFilename == fileName)
+ {
+ bv->ReadContents(fileName);
+ bv->ScFilename = fileName;
+ QDir d(fileName);
+ bv->visibleName = d.dirName();
+ bv->scrollToTop();
+ }
+ }
}
void Biblio::handleDoubleClick(QListWidgetItem *ite)
@@ -1912,7 +1934,7 @@
{
setWindowTitle( tr( "Scrapbook" ) );
newButton->setToolTip( tr( "Create a new scrapbook page" ) );
- loadButton->setToolTip( tr( "Load an existing scrapbook" ) );
+ // loadButton->setToolTip( tr( "Load an existing scrapbook" ) );
saveAsButton->setToolTip( tr( "Save the selected scrapbook" ) );
importButton->setToolTip( tr( "Import a scrapbook file from Scribus <=1.3.2" ) );
closeButton->setToolTip( tr( "Close the selected scrapbook" ) );
Modified: trunk/Scribus/scribus/ui/scrapbookpalette.h
URL: http://scribus.info/websvn/diff.php?repname=Scribus&rev=15526&path=/trunk/Scribus/scribus/ui/scrapbookpalette.h
==============================================================================
--- trunk/Scribus/scribus/ui/scrapbookpalette.h (original)
+++ trunk/Scribus/scribus/ui/scrapbookpalette.h Mon Oct 11 21:37:44 2010
@@ -95,6 +95,7 @@
void ObjFromFile(QString path, int testResult);
void ObjFromMenu(QString text);
void ObjFromMainMenu(QString text, int scrapID);
+ void reloadLib(QString fileName);
private slots:
void handleDoubleClick(QListWidgetItem *ite);
@@ -106,7 +107,7 @@
void deleteAllObj();
void renameObj();
void NewLib();
- void Load();
+// void Load();
void SaveAs();
void closeLib();
void libChanged(int index);
@@ -123,7 +124,7 @@
QString OldName;
QHBoxLayout* buttonLayout;
QToolButton* newButton;
- QToolButton* loadButton;
+// QToolButton* loadButton;
QToolButton* saveAsButton;
QToolButton* importButton;
QToolButton* closeButton;
More information about the scribus-commit
mailing list