summaryrefslogtreecommitdiffstats
path: root/src/fetch/fetcher.cpp
blob: 2a6fc87e868f318917439d758a25153b5f0aa51e (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
/***************************************************************************
    copyright            : (C) 2005-2006 by Robby Stephenson
    email                : robby@periapsis.org
 ***************************************************************************/

/***************************************************************************
 *                                                                         *
 *   This program is free software; you can redistribute it and/or modify  *
 *   it under the terms of version 2 of the GNU General Public License as  *
 *   published by the Free Software Foundation;                            *
 *                                                                         *
 ***************************************************************************/

#include "fetcher.h"
#include "messagehandler.h"
#include "../entry.h"

#include <kglobal.h>
#include <tdeconfig.h>

using Tellico::Fetch::Fetcher;
using Tellico::Fetch::SearchResult;

Fetcher::~Fetcher() {
  TDEConfigGroup config(TDEGlobal::config(), m_configGroup);
  saveConfigHook(config);
}

void Fetcher::readConfig(const TDEConfigGroup& config_, const TQString& groupName_) {
  m_configGroup = groupName_;

  TQString s = config_.readEntry("Name");
  if(!s.isEmpty()) {
    m_name = s;
  }
  m_updateOverwrite = config_.readBoolEntry("UpdateOverwrite", false);
  // be sure to read config for subclass
  readConfigHook(config_);
}

void Fetcher::message(const TQString& message_, int type_) const {
  if(m_messager) {
    m_messager->send(message_, static_cast<MessageHandler::Type>(type_));
  }
}

void Fetcher::infoList(const TQString& message_, const TQStringList& list_) const {
  if(m_messager) {
    m_messager->infoList(message_, list_);
  }
}

void Fetcher::updateEntry(Data::EntryPtr) {
  emit signalDone(this);
}

Tellico::Data::EntryPtr SearchResult::fetchEntry() {
  return fetcher->fetchEntry(uid);
}

#include "fetcher.moc"