29 #include <KConfigGroup>
34 static const char *
fqName =
"Finance::Quote";
67 const QString &group = QString(
"Online-Quote-Source-%1").arg(
m_name);
68 if (!kconfig->hasGroup(group)) {
71 KConfigGroup grp = kconfig->group(group);
72 m_sym = grp.readEntry(
"SymbolRegex");
73 m_date = grp.readEntry(
"DateRegex");
74 m_dateformat = grp.readEntry(
"DateFormatRegex",
"%m %d %y");
75 m_price = grp.readEntry(
"PriceRegex");
76 m_url = grp.readEntry(
"URL");
88 KConfigGroup grp = kconfig->group(QString(
"Online-Quote-Source-%1").arg(
m_name));
89 grp.writeEntry(
"URL",
m_url);
90 grp.writeEntry(
"PriceRegex",
m_price);
91 grp.writeEntry(
"DateRegex",
m_date);
93 grp.writeEntry(
"SymbolRegex",
m_sym);
97 grp.deleteEntry(
"SkipStripping");
108 kconfig->deleteGroup(QString(
"Online-Quote-Source-%1").arg(
m_name));
131 QFile file(f.absoluteFilePath());
132 if (!file.open(QIODevice::ReadOnly | QIODevice::Text))
135 QTextStream in(&file);
136 while (!in.atEnd()) {
137 QString line = in.readLine();
138 int index = line.indexOf(
"=");
141 QString key = line.left(index);
142 QString value = line.mid(index+1);
145 else if (key ==
"price") {
148 }
else if (key ==
"date") {
150 m_date.replace(
"\\\\",
"\\");
151 }
else if (key ==
"dateformat")
164 if (!file.open(QIODevice::WriteOnly | QIODevice::Text))
167 QTextStream out(&file);
168 out <<
"date=" <<
m_date <<
"\n";
170 out <<
"mode=HTML\n";
171 out <<
"price=" <<
m_price <<
"\n";
172 out <<
"url=" <<
m_url <<
"\n";
212 const QString &sym,
const QString &price,
213 const QString &date,
const QString &dateformat,
293 return d->
m_name.section(
' ', 1);
static const char * fqName
QString ghnsWriteFilePath()
Private(const Private *other)
AlkOnlineQuotesProfile * m_profile
QString ghnsReadFilePath()
void setPrice(const QString &price)
AlkOnlineQuotesProfile * profile()
AlkOnlineQuoteSource & operator=(AlkOnlineQuoteSource other)
void setDateformat(const QString &dateformat)
void setSym(const QString &symbol)
void setUrl(const QString &url)
void setProfile(AlkOnlineQuotesProfile *profile)
void setName(const QString &name)
QString financeQuoteName() const
void setSkipStripping(bool state)
bool isFinanceQuote() const
void rename(const QString &name)
QString ghnsWriteFileName()
bool skipStripping() const
QString dateformat() const
friend void swap(AlkOnlineQuoteSource &first, AlkOnlineQuoteSource &second)
void setDate(const QString &date)
QString hotNewStuffWriteFilePath(const QString &fileName) const
const Map defaultQuoteSources()
QString hotNewStuffReadFilePath(const QString &fileName) const
KConfig * kConfig() const