on xenial help sign in
Minor cleanups, removed debugging code.
58c9ea5Pawel Stolowski
plugins/Unity/categories.cpp+5−20
@@ -109,25 +109,15 @@ void Categories::onCategoryOrderChanged(std::vector<unsigned int> cat_order)
109 }
109 }
110
110
111 if (static_cast<int>(pos) != old_pos) {
111 if (static_cast<int>(pos) != old_pos) {
112− m_categoryOrder.move(old_pos, pos);
113 int target_pos = pos;
112 int target_pos = pos;
114− //if (pos > old_pos)
115− // target_pos = target_pos - old_pos;
116− bool status = beginMoveRows(QModelIndex(), old_pos, old_pos, QModelIndex(), target_pos);
113+ const bool status = beginMoveRows(QModelIndex(), old_pos, old_pos, QModelIndex(), target_pos);
117− if (status != true)
114+ if (status)
118− qWarning("!!!!!!!!!!!!!!!!!!!!!!!");
115+ m_categoryOrder.move(old_pos, pos);
119−
116+ else
120− qDebug() << "Moving category" << cat <<
117+ qWarning("beginMoveRows failed");
121− DeeListModel::data(createIndex(cat, 0),CategoryColumn::DISPLAY_NAME).toString()
122− << ":" << old_pos << "->" << pos << target_pos << "g";
123 endMoveRows();
118 endMoveRows();
124 }
119 }
125 }
120 }
126−
127− Q_FOREACH(auto cat, m_categoryOrder)
128− {
129− qDebug() << "Category" << DeeListModel::data(createIndex(cat, 0),CategoryColumn::DISPLAY_NAME).toString();
130− }
131}
121}
132
122
133void
123void
@@ -150,7 +140,6 @@ Categories::onCountChanged()
150 if (results) {
140 if (results) {
151 if (!m_updatedCategories.contains(results->categoryIndex())) {
141 if (!m_updatedCategories.contains(results->categoryIndex())) {
152 m_updatedCategories << results->categoryIndex();
142 m_updatedCategories << results->categoryIndex();
153− qDebug() << "Updated count of" << results->categoryIndex();
154 }
143 }
155 m_timer.start();
144 m_timer.start();
156 }
145 }
@@ -158,7 +147,6 @@ Categories::onCountChanged()
158
147
159void Categories::onRowCountChanged()
148void Categories::onRowCountChanged()
160{
149{
161− qDebug() << "Overriden model updated";
162 QAbstractItemModel* model = qobject_cast<QAbstractItemModel*>(sender());
150 QAbstractItemModel* model = qobject_cast<QAbstractItemModel*>(sender());
163 // find the corresponding category index
151 // find the corresponding category index
164 for (auto iter = m_overriddenCategories.begin(); iter != m_overriddenCategories.end(); ++iter) {
152 for (auto iter = m_overriddenCategories.begin(); iter != m_overriddenCategories.end(); ++iter) {
@@ -170,7 +158,6 @@ void Categories::onRowCountChanged()
170 QVector<int> roles;
158 QVector<int> roles;
171 roles.append(RoleCount);
159 roles.append(RoleCount);
172 QModelIndex changedIndex = index(i);
160 QModelIndex changedIndex = index(i);
173− qDebug() << "Overriden model" << id << "count update at index" << i;
174 Q_EMIT dataChanged(changedIndex, changedIndex, roles);
161 Q_EMIT dataChanged(changedIndex, changedIndex, roles);
175 break;
162 break;
176 }
163 }
@@ -295,11 +282,9 @@ Categories::data(const QModelIndex& index, int role) const
295 auto id = DeeListModel::data(realIndex, CategoryColumn::ID).toString();
282 auto id = DeeListModel::data(realIndex, CategoryColumn::ID).toString();
296 if (m_overriddenCategories.find(id) != m_overriddenCategories.end())
283 if (m_overriddenCategories.find(id) != m_overriddenCategories.end())
297 {
284 {
298− qDebug() << "Get count of overriden cat" << realRow << id << "at pos" << index.row() << "Count=" << m_overriddenCategories[id]->rowCount();
299 return QVariant::fromValue(m_overriddenCategories[id]->rowCount());
285 return QVariant::fromValue(m_overriddenCategories[id]->rowCount());
300 }
286 }
301 }
287 }
302− qDebug() << "Get count of cat" << DeeListModel::data(realIndex, CategoryColumn::ID).toString() << realRow << "at pos" << index.row() << "Count=" << getResults(realIndex.row())->rowCount();
303 return QVariant::fromValue(getResults(realRow)->rowCount());
288 return QVariant::fromValue(getResults(realRow)->rowCount());
304 default:
289 default:
305 return QVariant();
290 return QVariant();