view= new QDeclarativeView();
ctxt = view->rootContext();
+ ctxt->setContextProperty("focusss",true);
view->setSource(QUrl::fromLocalFile("/usr/share/mdictionary/qml/SearchBarWidget.qml"));
view->setResizeMode(QDeclarativeView::SizeRootObjectToView);
this, SLOT(nextCompleter()));
connect(rootObject, SIGNAL(prevCompleter()),
this, SLOT(prevCompleter()));
+ connect(rootObject, SIGNAL(checkFocus()),
+ this, SLOT(checkFocus()));
+ connect(rootObject, SIGNAL(nextFocus()),
+ this, SLOT(nextFocus()));
connect(this, SIGNAL(progresSetMax(QVariant)),
rootObject2, SLOT(setMax(QVariant)));
connect(this, SIGNAL(setCompleterText(QVariant)),
rootObject, SLOT(setCompleterText(QVariant)));
+ connect(this, SIGNAL(focusOff()),
+ rootObject, SLOT(focusOff()));
connect(busyTimer, SIGNAL(timeout()),
this, SLOT(updateBusyTimer()));
connect(&delayTimer, SIGNAL(timeout()),
this, SLOT(delaySearchTimeout()));
- view->setFocus();
-
#else
initializeUI();
connect(searchPushButton, SIGNAL(clicked()),
searchWordLineEdit->setFocus();
#endif
-
+ setFocus();
busy = false;
setEnabled(true);
updateHistoryButtons(false,false,false);
}
+void SearchBarWidget::checkFocus(){
+ if(focusWidget()!=QApplication::focusWidget())
+ emit focusOff();
+}
+
+void SearchBarWidget::nextFocus(){
+ parentWidget()->nextInFocusChain()->setFocus();
+}
+
void SearchBarWidget::textChange(QString text){
QLineEdit line;
QString toSend="";
QString tempString;
if(!preferedCompliter.isEmpty()){
int index = completerActualList.indexOf(preferedCompliter);
- qDebug()<<"index"<<index<<"size"<<completerActualList.size()<<"+1";
if(index!=-1 && completerActualList.size()>index+1){
preferedCompliter = completerActualList.at(index+1);
tempString=preferedCompliter;
QIcon SearchBarWidget::generateIcon(QIcon original, qreal rotation) {
- qDebug()<<"test2";
QPixmap p = original.pixmap(64);
if(rotation != 0) {
}
void SearchBarWidget::setFocus() {
- qDebug()<<"test3";
#ifndef Q_WS_MAEMO_5
view->setFocus();
#else
}
void SearchBarWidget::initializeUI() {
- qDebug()<<"test4";
#ifdef Q_WS_MAEMO_5
setMaximumHeight(150);
}
void SearchBarWidget::searchButtonClicked(QString text) {
- qDebug()<<"test5";
if(busy)
Q_EMIT stopSearching();
else
}
void SearchBarWidget::searchPushButtonClicked() {
- qDebug()<<"test6";
#ifdef Q_WS_MAEMO_5
if(busy) {
Q_EMIT stopSearching();
}
void SearchBarWidget::searchDelay(QString word) {
- qDebug()<<"test8";
if(!busy && !word.isEmpty()) {
#ifndef Q_WS_MAEMO_5
emit setLineEditText(word);
}
void SearchBarWidget::delaySearchTimeout() {
- qDebug()<<"test9";
delayTimer.stop();
if(!busy) {
Q_EMIT searchForTranslations(delayString);
}
void SearchBarWidget::setEnabled(bool enabled) {
- qDebug()<<"test10";
#ifndef Q_WS_MAEMO_5
emit setLineEditEnables(enabled);
if(!enabled) {
- qDebug()<<"tu???";
emit setEnableHistoryNext(false);
emit setEnableHistoryShow(false);
emit setEnableHistoryPrev(false);
historyShowToolButton->setEnabled(false);
}
#endif
-qDebug()<<"tu2???";
}
void SearchBarWidget::setBusy() {
- qDebug()<<"test11";
if(busy) return;
#ifndef Q_WS_MAEMO_5
}
void SearchBarWidget::updateBusyTimer(){
- qDebug()<<"test12";
if(progressMax==true){
emit progresSetValue2(0);
progressMax=false;
}
void SearchBarWidget::setIdle() {
- qDebug()<<"test13";
if(!busy) return;
#ifndef Q_WS_MAEMO_5
progressBar->hide();
void SearchBarWidget::clearSearchWordToolButtonClicked() {
- qDebug()<<"test14";
#ifdef Q_WS_MAEMO_5
searchWordLineEdit->clear();
#endif
void SearchBarWidget::updateHistoryButtons(bool prev, bool next, bool list) {
- qDebug()<<"test15";
if(!busy) {
#ifndef Q_WS_MAEMO_5
emit setEnableHistoryNext(next);
}
void SearchBarWidget::showHistoryButtonClicked() {
- qDebug()<<"test16";
#ifndef Q_WS_MAEMO_5
QPoint p=view->pos(); // = historyShowToolButton->pos();
p=mapToGlobal(p);