list_->clear();
}
- Source::SourceId sourceId = Source::stringToId(Settings::instance()->get("source"));
+ Source::SourceId id = Source::stringToId(Settings::instance()->get("source"));
- if(!source_)
+ if(!source_ || id != sourceId_)
{
- source_ = Source::getSource(sourceId);
+ sourceId_ = id;
+
+ if(source_)
+ {
+ delete source_;
+ source_ = 0;
+ }
+
+ source_ = Source::getSource(sourceId_);
Q_ASSERT(source_ != 0);
source_->setTimeout(REQUEST_TIMEOUT);
Source::SearchDetails const&, bool)));
}
- SourceCoreConfig* config = SourceCoreConfig::getCoreConfig(sourceId);
+ SourceCoreConfig* config = SourceCoreConfig::getCoreConfig(sourceId_);
Q_ASSERT(config != 0);
config->apply(source_);
delete config;
- Source::SearchType type;
-
- switch(details.type)
- {
- case 0:
- type = Source::PERSONS;
- break;
- case 1:
- type = Source::YELLOW_PAGES;
- break;
- default:
- qDebug() << "Unknown search type: " << details.type;
- return;
- }
-
show();
setAttribute(Qt::WA_Maemo5ShowProgressIndicator, true);
connectionManager_->connect();
source_->abort();
- source_->search(Source::SearchDetails(details.name, details.location, type));
+ source_->search(Source::SearchDetails(details.name, details.location, details.type));
}
if(!visible && source_)
{
source_->abort();
+
+
}
}