roles[IsBookmarkedRole] = "isBookmarked";
roles[NumberRole] = "number";
setRoleNames(roles);
- isBookmarkModeActive = false;
+ _isBookmarkModeActive = false;
}
if (!empty){
endResetModel();
}
- isBookmarkModeActive = false;
+ _isBookmarkModeActive = false;
}
QVariant WordListModel::data(const QModelIndex &index, int role) const
Q_EMIT addToBookmarks(word);
} else {
Q_EMIT removeFromBookmarks(word);
- if (isBookmarkModeActive == true){
+ if (_isBookmarkModeActive == true){
beginRemoveRows(QModelIndex(), index, index + 1);
this->_translations.remove(_wordList[index]);
this->_wordInBookmarks.remove(_wordList[index]);
void WordListModel::setBookmarkModeActive(bool mode)
{
- isBookmarkModeActive = mode;
+ _isBookmarkModeActive = mode;
}
QHash<QString, bool > _wordInBookmarks;
QList<QString> _wordList;
- bool isBookmarkModeActive;
+ bool _isBookmarkModeActive;
};
WordListWidget::WordListWidget(QWidget *parent):
QTreeView(parent) {
- isBookmarkModeActive = false;
+ _isBookmarkModeActive = false;
//creating new model to store words and stars
#ifdef Q_WS_MAEMO_5
connect(listModel, SIGNAL(removeFromBookmarks(QString)), this, SLOT(removeFromBookmarks(QString)));
connect(this, SIGNAL(setWordListState(QVariant)), rootObject, SLOT(setEnabled(QVariant)));
+ connect(this, SIGNAL(setWordListEmpty(QVariant)), rootObject, SLOT(setWordListEmpty(QVariant)));
#endif
}
if (result.count() == 0){
- result.insert("!@#$%", QList<Translation*>());
- wordsInBookmarks.insert("!@#$%", false);
+ //result.insert("!@#$%", QList<Translation*>());
+// wordsInBookmarks.insert("!@#$%", false);
Q_EMIT setWordListState(false);
+ Q_EMIT setWordListEmpty(true);
+ } else {
+ Q_EMIT setWordListEmpty(false);
}
if (listModel == 0){
listModel = new WordListModel(this);
}
- listModel->setBookmarkModeActive(isBookmarkModeActive);
- isBookmarkModeActive = false;
+ listModel->setBookmarkModeActive(_isBookmarkModeActive);
+ _isBookmarkModeActive = false;
listModel->setTranslations(result, wordsInBookmarks);
#endif
}
void WordListWidget::bookmarkModeActive(){
- isBookmarkModeActive = true;
+ _isBookmarkModeActive = true;
}
void removeBookmark(QList<Translation*>);
void setWordListState(QVariant state);
+ void setWordListEmpty(QVariant state);
public Q_SLOTS:
QHash<QString, QList<Translation*> > searchResult;
WordListProxyStyle* proxyStyle;
- bool isBookmarkModeActive;
+ bool _isBookmarkModeActive;
#ifndef Q_WS_MAEMO_5
QVBoxLayout* verticalLayout;
}
function setEnabled(Boolean) { wordList.enabled = Boolean }
+ function setWordListEmpty(Boolean) { wordList.empty = Boolean }
signal wordSelected(string word);
anchors.fill: parent
highlightResizeSpeed: 1000
+ property bool empty: false
delegate: Component{
id: wordListDelegate
}
+ Text {
+ id: emptyText
+ anchors.top: parent.top
+ anchors.left: parent.left
+ text: qsTr("Can't find any matching words")
+ }
+
model: wordModel
+
+ states: [
+ State {
+ name: "empty"
+ when: (wordList.empty == true);
+ PropertyChanges { target: emptyText; visible: true}
+ },
+ State {
+ name: "non-empty"
+ when: (wordList.empty == false);
+ PropertyChanges { target: emptyText; visible: false}
+ }
+ ]
}
}