]> git.lyx.org Git - lyx.git/blobdiff - src/frontends/qt4/GuiIdListModel.cpp
do what the FIXME suggested
[lyx.git] / src / frontends / qt4 / GuiIdListModel.cpp
index ceb88baaa5d2cdd152b653d513e3a47be87eb9b3..2d15b0efabf511c46c25b3660e67fbdbac4c8dcc 100644 (file)
@@ -71,7 +71,7 @@ bool GuiIdListModel::insertRows(int row, int count,
 bool GuiIdListModel::removeRows(int row, int count, 
                QModelIndex const & /*parent*/)
 {
-       if (!rowIsValid(row) || row + count > userData_.size() ||
+       if (!rowIsValid(row) || row + count > int(userData_.size()) ||
            count < 0)
                return false;
        if (count == 0)
@@ -84,7 +84,7 @@ bool GuiIdListModel::removeRows(int row, int count,
 }
 
 
-void GuiIdListModel::insertRow(int const i, std::string const & uiString, 
+void GuiIdListModel::insertRow(int const i, QString const & uiString, 
                std::string const & idString)
 {
        insertRows(i, 1);
@@ -93,8 +93,7 @@ void GuiIdListModel::insertRow(int const i, std::string const & uiString,
 }
 
 
-QMap<int, QVariant> 
-       GuiIdListModel::itemData(QModelIndex const & index ) const 
+QMap<int, QVariant> GuiIdListModel::itemData(QModelIndex const & index) const
 {
        int const row = index.row();
        if (!rowIsValid(row))
@@ -104,10 +103,24 @@ QMap<int, QVariant>
        return qm;
 }
 
-/* The following functions are currently unused but are retained here in
-   case they should at some point be useful.
+
+int GuiIdListModel::findIDString(std::string const & idString) 
+{
+       vector<OurData>::const_iterator it  = userData_.begin();
+       vector<OurData>::const_iterator end = userData_.end();
+       for (; it != end; ++it)
+               if (fromqstr(it->idString.toString()) == idString)
+                       return it - userData_.begin();
+       return -1;
+}
+
+
+#if 0
+// The following functions are currently unused but are retained here in
+//   case they should at some point be useful.
    
-QStringList GuiIdListModel::getIDStringList() const {
+QStringList GuiIdListModel::getIDStringList() const
+{
        QStringList qsl;
        vector<OurData>::const_iterator it  = userData_.begin();
        vector<OurData>::const_iterator end = userData_.end();
@@ -125,17 +138,8 @@ void GuiIdListModel::insertRow(int const i, QString const & uiString,
        setIDString(i, idString);
 }
 
-bool GuiIdListModel::containsID(QVariant const & q) const
-{
-       vector<OurData>::const_iterator it  = userData_.begin();
-       vector<OurData>::const_iterator end = userData_.end();
-       for (; it != end; ++it)
-               if (it->idString == q)
-                       return true;
-       return false;
-}
-*/
+#endif
 
-}
-}
+} // namespace frontend
+} // namespace lyx