r19065 by jghali - remove some unnecessary indentation levels

scribus-commit scribus-commit at lists.scribus.net
Sun Apr 20 22:03:04 UTC 2014


Author: jghali
Date: Sun Apr 20 22:03:04 2014
New Revision: 19065

URL: http://scribus.net/websvn/listing.php?repname=Scribus&sc=1&rev=19065
Log:
remove some unnecessary indentation levels

Modified:
    branches/Version14x/Scribus/scribus/scrapbookpalette.cpp

Modified: branches/Version14x/Scribus/scribus/scrapbookpalette.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=19065&path=/branches/Version14x/Scribus/scribus/scrapbookpalette.cpp
==============================================================================
--- branches/Version14x/Scribus/scribus/scrapbookpalette.cpp (original)
+++ branches/Version14x/Scribus/scribus/scrapbookpalette.cpp Sun Apr 20 22:03:04 2014
@@ -578,102 +578,8 @@
 	for (int rd = 0; rd < fileNames.count(); ++rd)
 	{
 		QString fileName = fileNames[rd];
-		if (!fileName.isEmpty())
-		{
-			QDir d(fileName);
-			activeBView = new BibView(this);
-			QFileInfo fd(fileName);
-			activeBView->canWrite = fd.isWritable();
-			activeBView->setAcceptDrops(activeBView->canWrite);
-			if (activeBView->canWrite)
-				Frame3->addItem(activeBView, d.dirName());
-			else
-				Frame3->addItem(activeBView, QIcon(loadIcon("16/lock.png")), d.dirName());
-			activeBView->ReadContents(fileName);
-			activeBView->ScFilename = fileName;
-			activeBView->visibleName = d.dirName();
-			activeBView->scrollToTop();
-		}
-	}
-	activeBView = (BibView*)Frame3->widget(0);
-	Frame3->setCurrentIndex(0);
-	connect(Frame3, SIGNAL(currentChanged(int)), this, SLOT(libChanged(int )));
-	connect(activeBView, SIGNAL(objDropped(QString)), this, SLOT(ObjFromMenu(QString)));
-	connect(activeBView, SIGNAL(customContextMenuRequested (const QPoint &)), this, SLOT(HandleMouse(QPoint)));
-	connect(activeBView, SIGNAL(itemDoubleClicked(QListWidgetItem *)), this, SLOT(handleDoubleClick(QListWidgetItem *)));
-}
-
-QStringList Biblio::getOpenScrapbooks()
-{
-	QStringList ret;
-	ret.clear();
-	if (Frame3->count() > 2) // omit the first 2 Tabs since they contain the main and temp scrapbook
-	{
-		for (int a = 2; a < Frame3->count(); a++)
-		{
-			BibView* bv = (BibView*)Frame3->widget(a);
-			ret.append(bv->ScFilename);
-		}
-	}
-	return ret;
-}
-
-void Biblio::setScrapbookFileName(QString fileName)
-{
-	activeBView->ScFilename=fileName;
-}
-
-const QString Biblio::getScrapbookFileName()
-{
-	return activeBView->ScFilename;
-}
-
-const int Biblio::objectCount()
-{
-	return activeBView->objectMap.count();
-}
-
-void Biblio::readOldContents(QString fileName, QString newName)
-{
-	activeBView->ReadOldContents(fileName, newName);
-	activeBView->scrollToTop();
-}
-
-void Biblio::readContents(QString fileName)
-{
-	activeBView->ReadContents(fileName);
-}
-
-void Biblio::readTempContents(QString fileName)
-{
-	tempBView->ReadContents(fileName);
-	tempBView->ScFilename = fileName;
-	tempCount = tempBView->objectMap.count();
-}
-
-void Biblio::installEventFilter(QObject *filterObj)
-{
-	ScrPaletteBase::installEventFilter(filterObj);
-	activeBView->installEventFilter(filterObj);
-	tempBView->installEventFilter(filterObj);
-}
-
-void Biblio::NewLib()
-{
-	PrefsContext* dirs = PrefsManager::instance()->prefsFile->getContext("dirs");
-	QString fileName = QFileDialog::getExistingDirectory(this, tr("Choose a Scrapbook Directory"), dirs->get("scrap_load", "."));
-	if (!fileName.isEmpty())
-	{
-		for (int a = 0; a < Frame3->count(); a++)
-		{
-			BibView* bv = (BibView*)Frame3->widget(a);
-			if (fileName == bv->ScFilename)
-				return;
-		}
-		disconnect(activeBView, SIGNAL(objDropped(QString)), this, SLOT(ObjFromMenu(QString)));
-		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 )));
+		if (fileName.isEmpty())
+			continue;
 		QDir d(fileName);
 		activeBView = new BibView(this);
 		QFileInfo fd(fileName);
@@ -686,54 +592,147 @@
 		activeBView->ReadContents(fileName);
 		activeBView->ScFilename = fileName;
 		activeBView->visibleName = d.dirName();
-		Frame3->setCurrentWidget(activeBView);
-		d.cdUp();
-		dirs->set("scrap_load", d.absolutePath());
 		activeBView->scrollToTop();
-		connect(Frame3, SIGNAL(currentChanged(int)), this, SLOT(libChanged(int )));
-		connect(activeBView, SIGNAL(objDropped(QString)), this, SLOT(ObjFromMenu(QString)));
-		connect(activeBView, SIGNAL(customContextMenuRequested (const QPoint &)), this, SLOT(HandleMouse(QPoint)));
-		connect(activeBView, SIGNAL(itemDoubleClicked(QListWidgetItem *)), this, SLOT(handleDoubleClick(QListWidgetItem *)));
-	}
-}
-
-void Biblio::Load()
+	}
+	activeBView = (BibView*)Frame3->widget(0);
+	Frame3->setCurrentIndex(0);
+	connect(Frame3, SIGNAL(currentChanged(int)), this, SLOT(libChanged(int )));
+	connect(activeBView, SIGNAL(objDropped(QString)), this, SLOT(ObjFromMenu(QString)));
+	connect(activeBView, SIGNAL(customContextMenuRequested (const QPoint &)), this, SLOT(HandleMouse(QPoint)));
+	connect(activeBView, SIGNAL(itemDoubleClicked(QListWidgetItem *)), this, SLOT(handleDoubleClick(QListWidgetItem *)));
+}
+
+QStringList Biblio::getOpenScrapbooks()
+{
+	QStringList ret;
+	ret.clear();
+	if (Frame3->count() > 2) // omit the first 2 Tabs since they contain the main and temp scrapbook
+	{
+		for (int a = 2; a < Frame3->count(); a++)
+		{
+			BibView* bv = (BibView*)Frame3->widget(a);
+			ret.append(bv->ScFilename);
+		}
+	}
+	return ret;
+}
+
+void Biblio::setScrapbookFileName(QString fileName)
+{
+	activeBView->ScFilename=fileName;
+}
+
+const QString Biblio::getScrapbookFileName()
+{
+	return activeBView->ScFilename;
+}
+
+const int Biblio::objectCount()
+{
+	return activeBView->objectMap.count();
+}
+
+void Biblio::readOldContents(QString fileName, QString newName)
+{
+	activeBView->ReadOldContents(fileName, newName);
+	activeBView->scrollToTop();
+}
+
+void Biblio::readContents(QString fileName)
+{
+	activeBView->ReadContents(fileName);
+}
+
+void Biblio::readTempContents(QString fileName)
+{
+	tempBView->ReadContents(fileName);
+	tempBView->ScFilename = fileName;
+	tempCount = tempBView->objectMap.count();
+}
+
+void Biblio::installEventFilter(QObject *filterObj)
+{
+	ScrPaletteBase::installEventFilter(filterObj);
+	activeBView->installEventFilter(filterObj);
+	tempBView->installEventFilter(filterObj);
+}
+
+void Biblio::NewLib()
 {
 	PrefsContext* dirs = PrefsManager::instance()->prefsFile->getContext("dirs");
 	QString fileName = QFileDialog::getExistingDirectory(this, tr("Choose a Scrapbook Directory"), dirs->get("scrap_load", "."));
-	if (!fileName.isEmpty())
-	{
-		for (int a = 0; a < Frame3->count(); a++)
-		{
-			BibView* bv = (BibView*)Frame3->widget(a);
-			if (fileName == bv->ScFilename)
-				return;
-		}
-		disconnect(activeBView, SIGNAL(objDropped(QString)), this, SLOT(ObjFromMenu(QString)));
-		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 )));
-		QDir d(fileName);
-		activeBView = new BibView(this);
-		QFileInfo fd(fileName);
-		activeBView->canWrite = fd.isWritable();
-		activeBView->setAcceptDrops(activeBView->canWrite);
-		if (activeBView->canWrite)
-			Frame3->addItem(activeBView, d.dirName());
-		else
-			Frame3->addItem(activeBView, QIcon(loadIcon("16/lock.png")), d.dirName());
-		activeBView->ReadContents(fileName);
-		activeBView->ScFilename = fileName;
-		activeBView->visibleName = d.dirName();
-		Frame3->setCurrentWidget(activeBView);
-		d.cdUp();
-		dirs->set("scrap_load", d.absolutePath());
-		activeBView->scrollToTop();
-		connect(Frame3, SIGNAL(currentChanged(int)), this, SLOT(libChanged(int )));
-		connect(activeBView, SIGNAL(objDropped(QString)), this, SLOT(ObjFromMenu(QString)));
-		connect(activeBView, SIGNAL(customContextMenuRequested (const QPoint &)), this, SLOT(HandleMouse(QPoint)));
-		connect(activeBView, SIGNAL(itemDoubleClicked(QListWidgetItem *)), this, SLOT(handleDoubleClick(QListWidgetItem *)));
-	}
+	if (fileName.isEmpty())
+		return;
+
+	for (int a = 0; a < Frame3->count(); a++)
+	{
+		BibView* bv = (BibView*)Frame3->widget(a);
+		if (fileName == bv->ScFilename)
+			return;
+	}
+	disconnect(activeBView, SIGNAL(objDropped(QString)), this, SLOT(ObjFromMenu(QString)));
+	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 )));
+	QDir d(fileName);
+	activeBView = new BibView(this);
+	QFileInfo fd(fileName);
+	activeBView->canWrite = fd.isWritable();
+	activeBView->setAcceptDrops(activeBView->canWrite);
+	if (activeBView->canWrite)
+		Frame3->addItem(activeBView, d.dirName());
+	else
+		Frame3->addItem(activeBView, QIcon(loadIcon("16/lock.png")), d.dirName());
+	activeBView->ReadContents(fileName);
+	activeBView->ScFilename = fileName;
+	activeBView->visibleName = d.dirName();
+	Frame3->setCurrentWidget(activeBView);
+	d.cdUp();
+	dirs->set("scrap_load", d.absolutePath());
+	activeBView->scrollToTop();
+	connect(Frame3, SIGNAL(currentChanged(int)), this, SLOT(libChanged(int )));
+	connect(activeBView, SIGNAL(objDropped(QString)), this, SLOT(ObjFromMenu(QString)));
+	connect(activeBView, SIGNAL(customContextMenuRequested (const QPoint &)), this, SLOT(HandleMouse(QPoint)));
+	connect(activeBView, SIGNAL(itemDoubleClicked(QListWidgetItem *)), this, SLOT(handleDoubleClick(QListWidgetItem *)));
+}
+
+void Biblio::Load()
+{
+	PrefsContext* dirs = PrefsManager::instance()->prefsFile->getContext("dirs");
+	QString fileName = QFileDialog::getExistingDirectory(this, tr("Choose a Scrapbook Directory"), dirs->get("scrap_load", "."));
+	if (fileName.isEmpty())
+		return;
+
+	for (int a = 0; a < Frame3->count(); a++)
+	{
+		BibView* bv = (BibView*)Frame3->widget(a);
+		if (fileName == bv->ScFilename)
+			return;
+	}
+	disconnect(activeBView, SIGNAL(objDropped(QString)), this, SLOT(ObjFromMenu(QString)));
+	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 )));
+	QDir d(fileName);
+	activeBView = new BibView(this);
+	QFileInfo fd(fileName);
+	activeBView->canWrite = fd.isWritable();
+	activeBView->setAcceptDrops(activeBView->canWrite);
+	if (activeBView->canWrite)
+		Frame3->addItem(activeBView, d.dirName());
+	else
+		Frame3->addItem(activeBView, QIcon(loadIcon("16/lock.png")), d.dirName());
+	activeBView->ReadContents(fileName);
+	activeBView->ScFilename = fileName;
+	activeBView->visibleName = d.dirName();
+	Frame3->setCurrentWidget(activeBView);
+	d.cdUp();
+	dirs->set("scrap_load", d.absolutePath());
+	activeBView->scrollToTop();
+	connect(Frame3, SIGNAL(currentChanged(int)), this, SLOT(libChanged(int )));
+	connect(activeBView, SIGNAL(objDropped(QString)), this, SLOT(ObjFromMenu(QString)));
+	connect(activeBView, SIGNAL(customContextMenuRequested (const QPoint &)), this, SLOT(HandleMouse(QPoint)));
+	connect(activeBView, SIGNAL(itemDoubleClicked(QListWidgetItem *)), this, SLOT(handleDoubleClick(QListWidgetItem *)));
 }
 
 void Biblio::Import()
@@ -785,21 +784,19 @@
 		close();
 	if ((Frame3->currentIndex() == 0) || (Frame3->currentIndex() == 1))
 		return;
-	else
-	{
-		disconnect(activeBView, SIGNAL(objDropped(QString)), this, SLOT(ObjFromMenu(QString)));
-		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 )));
-		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);
-		Frame3->setCurrentIndex(0);
-		connect(Frame3, SIGNAL(currentChanged(int)), this, SLOT(libChanged(int )));
-		connect(activeBView, SIGNAL(objDropped(QString)), this, SLOT(ObjFromMenu(QString)));
-		connect(activeBView, SIGNAL(customContextMenuRequested (const QPoint &)), this, SLOT(HandleMouse(QPoint)));
-		connect(activeBView, SIGNAL(itemDoubleClicked(QListWidgetItem *)), this, SLOT(handleDoubleClick(QListWidgetItem *)));
-	}
+
+	disconnect(activeBView, SIGNAL(objDropped(QString)), this, SLOT(ObjFromMenu(QString)));
+	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 )));
+	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);
+	Frame3->setCurrentIndex(0);
+	connect(Frame3, SIGNAL(currentChanged(int)), this, SLOT(libChanged(int )));
+	connect(activeBView, SIGNAL(objDropped(QString)), this, SLOT(ObjFromMenu(QString)));
+	connect(activeBView, SIGNAL(customContextMenuRequested (const QPoint &)), this, SLOT(HandleMouse(QPoint)));
+	connect(activeBView, SIGNAL(itemDoubleClicked(QListWidgetItem *)), this, SLOT(handleDoubleClick(QListWidgetItem *)));
 }
 
 void Biblio::libChanged(int index)




More information about the scribus-commit mailing list