#!/bin/sh -e
-gtk-update-icon-cache -f /usr/share/icons/hicolor
/etc/init.d/jenirokd start -boot
exit 0
#include "source.h"
#include "eniro.h"
#include "mobil1881.h"
+#include "dastelefonbuch.h"
namespace
{
static const QString SOURCE_NAMES[Source::SOURCE_COUNT] =
{
"Eniro (FI, SE, DK)",
- "1881 Mobil (NO)"
+ "1881 Mobil (NO)",
+ "Das Telefonbuch (DE)"
};
static const QString SOURCE_IDS[Source::SOURCE_COUNT] =
{
"eniro",
- "1881mobil"
+ "1881mobil",
+ "dastelefonbuch"
};
}
case MOBIL1881:
return new Mobil1881(parent);
break;
+ case DASTELEFONBUCH:
+ return new DasTelefonbuch(parent);
+ break;
default:
qDebug() << "Unknown source:" << id;
}
return maxResults_;
}
+void Source::getSearchTypes(QList<SearchType>& types) const
+{
+ types.clear();
+ types.push_back(PERSONS);
+ types.push_back(YELLOW_PAGES);
+}
+
void Source::setTimeout(unsigned int timeout)
{
timeout_ = timeout;
enum Error {NO_ERROR, CONNECTION_FAILURE, INVALID_LOGIN, TIMEOUT};
- enum SourceId {ENIRO, MOBIL1881};
- static int const SOURCE_COUNT = 2;
+ enum SourceId {ENIRO, MOBIL1881, DASTELEFONBUCH};
+ static int const SOURCE_COUNT = 3;
struct SourceDetails
{
static Source* getSource();
virtual void abort();
virtual void search(SearchDetails const& details) = 0;
+ virtual void getSearchTypes(QList<SearchType>& types) const;
void setMaxResults(unsigned int results);
unsigned int getMaxResults() const;
void setTimeout(unsigned int ms);
return new EniroCoreConfig();
break;
case Source::MOBIL1881:
+ case Source::DASTELEFONBUCH:
return new EmptyCoreConfig(); // No configuration
break;
default:
../common/db.cpp \
../common/settings.cpp \
../common/connectionmanager.cpp \
- ../common/cache.cpp
+ ../common/cache.cpp \
+ ../common/dastelefonbuch.cpp
HEADERS += calllistener.h \
informationbox.h \
../common/source.h \
../common/db.h \
../common/settings.h \
../common/connectionmanager.h \
- ../common/cache.h
+ ../common/cache.h \
+ ../common/dastelefonbuch.h
TRANSLATIONS = ../common/translations/fi_FI.ts
RESOURCES = ../common/translations.grc
INCLUDEPATH += ../common
../common/db.cpp \
../common/settings.cpp \
../common/connectionmanager.cpp \
- ../common/cache.cpp
+ ../common/cache.cpp \
+ ../common/dastelefonbuch.cpp
HEADERS += mainwindow.h \
searchdialog.h \
resultwindow.h \
../common/db.h \
../common/settings.h \
../common/connectionmanager.h \
- ../common/cache.h
+ ../common/cache.h \
+ ../common/dastelefonbuch.h
TRANSLATIONS = ../common/translations/fi_FI.ts
RESOURCES = icons.grc ../common/translations.grc
INCLUDEPATH += ../common
if(!settingsDialog_)
{
settingsDialog_ = new SettingsDialog(this);
+
+ if(searchDialog_)
+ {
+ connect(settingsDialog_, SIGNAL(saved()), searchDialog_, SLOT(loadSearchTypes()));
+ }
}
settingsDialog_->show();
searchDialog_ = new SearchDialog(this);
connect(searchDialog_, SIGNAL(search(SearchDialog::SearchDetails&)),
this, SLOT(handleSearch(SearchDialog::SearchDetails&)));
+
+ if(settingsDialog_)
+ {
+ connect(settingsDialog_, SIGNAL(saved()), searchDialog_, SLOT(loadSearchTypes()));
+ }
}
searchDialog_->show();
#include <QtGui/QDialogButtonBox>
#include <QMaemo5ValueButton>
#include "searchdialog.h"
+#include "source.h"
+#include "settings.h"
SearchDialog::SearchDialog(QWidget* parent): QDialog(parent),
numberInput_(0), locationInput_(0), selector_(0)
locationLayout->addWidget(locationInput_);
selector_ = new ButtonSelector(tr("Type"), this);
- selector_->addItem(tr("Persons"));
- selector_->addItem(tr("Companies"));
+ loadSearchTypes();
QVBoxLayout* leftLayout = new QVBoxLayout;
leftLayout->addLayout(numberLayout);
}
details.location = locationInput_->text();
- details.type = selector_->currentIndex();
+ details.type = selector_->value().toInt();
emit search(details);
hide();
}
numberInput_->setFocus();
}
}
+
+void SearchDialog::loadSearchTypes()
+{
+ selector_->clear();
+
+ Source* source = Source::getSource(Source::stringToId(Settings::instance()->get("source")));
+
+ QList<Source::SearchType> types;
+ source->getSearchTypes(types);
+
+ if(types.size() > 1)
+ {
+ for(int i = 0; i < types.size(); i++)
+ {
+ switch(types.at(i))
+ {
+ case Source::PERSONS:
+ selector_->addItem(tr("Persons"), static_cast<int>(Source::PERSONS));
+ break;
+ case Source::YELLOW_PAGES:
+ selector_->addItem(tr("Companies"), static_cast<int>(Source::YELLOW_PAGES));
+ break;
+ case Source::BOTH:
+ break;
+ }
+ }
+
+ if(!selector_->isVisible())
+ {
+ selector_->show();
+ }
+ }
+ else
+ {
+ selector_->hide();
+ }
+}
signals:
void search(SearchDialog::SearchDetails& details);
+public slots:
+ void loadSearchTypes();
+
private slots:
void searchPressed();
Daemon::restart();
}
+ emit saved();
+
}
void SettingsDialog::resetCache()
public:
SettingsDialog(QWidget* parent = 0);
+signals:
+ void saved();
+
public slots:
void saveSettings();
void resetCache();
return new EniroGuiConfig(parent);
break;
case Source::MOBIL1881:
+ case Source::DASTELEFONBUCH:
return new EmptyGuiConfig(parent); // No configuration
break;
default: