#include "sourcecoreconfig.h"
ResultWindow::ResultWindow(QWidget* parent): QMainWindow(parent),
-source_(0), list_(0), connectionManager_(0)
+sourceId_(Source::SOURCE_NONE), source_(0), list_(0), connectionManager_(0)
{
setAttribute(Qt::WA_Maemo5StackedWindow);
setWindowTitle(tr("Search results"));
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);
if(!visible && source_)
{
source_->abort();
+
+
}
}