Commit ebff93e1 authored by Christoph Cullmann's avatar Christoph Cullmann 🐮
Browse files

show documents as loaded from config

BUG: 353373
parent 586c1708
Pipeline #146537 passed with stage
in 3 minutes and 46 seconds
......@@ -97,18 +97,6 @@ void KateSessionTest::createFrom()
QCOMPARE(ns->config()->group(groupName).readEntry("foo"), QLatin1String("bar"));
}
void KateSessionTest::documents()
{
KateSession::Ptr s = KateSession::create(m_tmpfile->fileName(), QStringLiteral("session name"));
s->setDocuments(42);
QCOMPARE((int)s->documents(), 42);
s->config()->sync();
KConfig c(m_tmpfile->fileName());
QCOMPARE(c.group("Open Documents").readEntry<int>("Count", 0), 42);
}
void KateSessionTest::setFile()
{
KateSession::Ptr s = KateSession::create(m_tmpfile->fileName(), QStringLiteral("session name"));
......
......@@ -24,7 +24,6 @@ private Q_SLOTS:
void createAnonymous();
void createAnonymousFrom();
void createFrom();
void documents();
void setFile();
void setName();
void timestamp();
......
......@@ -24,7 +24,6 @@ KateSession::KateSession(const QString &file, const QString &name, const bool an
: m_name(name)
, m_file(file)
, m_anonymous(anonymous)
, m_documents(0)
{
Q_ASSERT(!m_file.isEmpty());
......@@ -36,9 +35,6 @@ KateSession::KateSession(const QString &file, const QString &name, const bool an
}
m_timestamp = QFileInfo(m_file).lastModified();
// get the document count
m_documents = config()->group(opGroupName).readEntry(keyCount, 0);
}
const QString &KateSession::file() const
......@@ -46,10 +42,9 @@ const QString &KateSession::file() const
return m_file;
}
void KateSession::setDocuments(const unsigned int number)
unsigned int KateSession::documents()
{
config()->group(opGroupName).writeEntry(keyCount, number);
m_documents = number;
return config()->group(opGroupName).readEntry(keyCount, 0);
}
void KateSession::setFile(const QString &filename)
......
......@@ -51,15 +51,7 @@ public:
* count of documents in this session
* @return documents count
*/
unsigned int documents() const
{
return m_documents;
}
/**
* update \p number of opened documents in session
*/
void setDocuments(const unsigned int number);
unsigned int documents();
/**
* @return true if this is anonymous/new session
......@@ -120,7 +112,6 @@ private:
QString m_name;
QString m_file;
bool m_anonymous;
unsigned int m_documents;
std::unique_ptr<KConfig> m_config;
QDateTime m_timestamp;
};
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment