gnunet-svn
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[GNUnet-SVN] r4654 - gnunet-qt/src/plugins/fs


From: gnunet
Subject: [GNUnet-SVN] r4654 - gnunet-qt/src/plugins/fs
Date: Fri, 9 Mar 2007 14:51:33 -0700 (MST)

Author: durner
Date: 2007-03-09 14:51:33 -0700 (Fri, 09 Mar 2007)
New Revision: 4654

Modified:
   gnunet-qt/src/plugins/fs/fs-search.cc
   gnunet-qt/src/plugins/fs/fs-search.h
Log:
fix crash in clear handler

Modified: gnunet-qt/src/plugins/fs/fs-search.cc
===================================================================
--- gnunet-qt/src/plugins/fs/fs-search.cc       2007-03-09 20:24:24 UTC (rev 
4653)
+++ gnunet-qt/src/plugins/fs/fs-search.cc       2007-03-09 21:51:33 UTC (rev 
4654)
@@ -94,7 +94,8 @@
 
 void GFSSearch::clear()
 {
-  m->removeRows(0, m->rowCount());
+  m->clear();
+  setupColumns();
 }
 
 void GFSSearch::setColHidden(int col, bool hidden)
@@ -153,20 +154,13 @@
       uri.toString() + " (" + QString::number(m->rowCount()) + ")");
 }
 
-void GFSSearch::setModel(QStandardItemModel *model)
+void GFSSearch::setupColumns()
 {
-  QByteArray data;
   int colIdx;
   GIntList cols;
   EXTRACTOR_KeywordType maxType;
   int typeIdx;
-  
-  m = model;
-  treeResults->setModel(model);
-  connect(model, SIGNAL(rowsInserted(const QModelIndex &, int, int)), this,
-    SLOT(resultInserted()));
 
-  // set columns
   maxType = EXTRACTOR_getHighestKeywordTypeNumber();
   m->setColumnCount(SEARCH_MAX_COLUMN + 1);
   for (typeIdx = 0; typeIdx <= maxType; typeIdx++)
@@ -186,10 +180,22 @@
   cols.append(EXTRACTOR_MIMETYPE);
   cols.append(EXTRACTOR_THUMBNAIL_DATA);
   
-  for (colIdx = 0; colIdx < model->columnCount(); colIdx++)
+  for (colIdx = 0; colIdx < m->columnCount(); colIdx++)
     setColHidden(MODEL_IDX(colIdx), !cols.contains(colIdx));
   
   treeResults->setColumnWidth(0, 200);
+}
+
+void GFSSearch::setModel(QStandardItemModel *model)
+{
+  QByteArray data;
+  
+  m = model;
+  treeResults->setModel(model);
+  connect(model, SIGNAL(rowsInserted(const QModelIndex &, int, int)), this,
+    SLOT(resultInserted()));
+
+  setupColumns();
     
   resultInserted();
 }

Modified: gnunet-qt/src/plugins/fs/fs-search.h
===================================================================
--- gnunet-qt/src/plugins/fs/fs-search.h        2007-03-09 20:24:24 UTC (rev 
4653)
+++ gnunet-qt/src/plugins/fs/fs-search.h        2007-03-09 21:51:33 UTC (rev 
4654)
@@ -59,6 +59,7 @@
   QStandardItemModel *m;
   
   void setColHidden(int col, bool hidden);
+  void setupColumns();
 protected slots:
   void closeClicked();
   void downloadClicked();





reply via email to

[Prev in Thread] Current Thread [Next in Thread]