r18294 by jghali - #11552: Selecting all fonts via Ctrl+A and deleting them in the font substitution dialog doesn't work

scribus-commit scribus-commit at lists.scribus.net
Tue May 28 19:05:43 UTC 2013


Author: jghali
Date: Tue May 28 19:05:42 2013
New Revision: 18294

URL: http://scribus.net/websvn/listing.php?repname=Scribus&sc=1&rev=18294
Log:
#11552: Selecting all fonts via Ctrl+A and deleting them in the font substitution dialog doesn't work

Modified:
    branches/Version14x/Scribus/scribus/fontprefs.cpp
    branches/Version14x/Scribus/scribus/fontprefs.h

Modified: branches/Version14x/Scribus/scribus/fontprefs.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=18294&path=/branches/Version14x/Scribus/scribus/fontprefs.cpp
==============================================================================
--- branches/Version14x/Scribus/scribus/fontprefs.cpp (original)
+++ branches/Version14x/Scribus/scribus/fontprefs.cpp Tue May 28 19:05:42 2013
@@ -135,7 +135,7 @@
 	addTab( tab3, tr( "Additional &Paths" ) );
 
 	// signals and slots connections
-	connect(Table3, SIGNAL(cellClicked(int, int)), this, SLOT(ReplaceSel(int, int)));
+	connect(Table3, SIGNAL(itemSelectionChanged()), this, SLOT(ReplaceSel()));
 	connect(DelB, SIGNAL(clicked()), this, SLOT(DelEntry()));
 }
 
@@ -144,9 +144,10 @@
 	rebuildDialog();
 }
 
-void FontPrefs::ReplaceSel(int, int)
-{
-	DelB->setEnabled(true);
+void FontPrefs::ReplaceSel()
+{
+	int selCount = Table3->selectedItems().count();
+	DelB->setEnabled(selCount > 0);
 }
 
 void FontPrefs::UpdateFliste()
@@ -176,11 +177,17 @@
 
 void FontPrefs::DelEntry()
 {
-	int r = Table3->currentRow();
-	QString tmp = Table3->item(r, 0)->text();
-	Table3->removeRow(r);
-	delete FlagsRepl.takeAt(r);
-	RList.remove(tmp);
+	// This works a because selection mode is "Full rows"
+	QList<QTableWidgetItem*> selItems = Table3->selectedItems();
+	for (int i = 0; i < selItems.count(); ++i)
+	{
+		QTableWidgetItem* item = selItems.at(i);
+		int r = item->row();
+		QString tmp = Table3->item(r, 0)->text();
+		Table3->removeRow(r);
+		delete FlagsRepl.takeAt(r);
+		RList.remove(tmp);
+	}
 	DelB->setEnabled(false);
 }
 

Modified: branches/Version14x/Scribus/scribus/fontprefs.h
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=18294&path=/branches/Version14x/Scribus/scribus/fontprefs.h
==============================================================================
--- branches/Version14x/Scribus/scribus/fontprefs.h (original)
+++ branches/Version14x/Scribus/scribus/fontprefs.h Tue May 28 19:05:42 2013
@@ -61,7 +61,7 @@
 	ScribusDoc* docc;
 
 public slots:
-	void ReplaceSel(int r, int c);
+	void ReplaceSel();
 	void UpdateFliste();
 	void DelEntry();
 	void SelectPath(QListWidgetItem *c);




More information about the scribus-commit mailing list