Commit 0164fc12 authored by Laurent Montel's avatar Laurent Montel 😁

Allow to save current tab

parent d3e5173f
......@@ -277,10 +277,14 @@ void FrameManager::saveProperties(KConfigGroup &config)
QHash<int, Frame *>::const_iterator end(m_frames.constEnd());
for (i = m_frames.constBegin(); i != end; ++i) {
// No need to save the main frame
if (i.value() && qobject_cast<WebEngineFrame *>(i.value())) {
Frame *currentFrame = i.value();
if (currentFrame && qobject_cast<WebEngineFrame *>(currentFrame)) {
QString newPrefix = QLatin1Char('T') + QString::number(i.key());
if (i.value()->saveConfig(config, newPrefix + QLatin1Char('_'))) {
if (currentFrame->saveConfig(config, newPrefix + QLatin1Char('_'))) {
strlst.append(newPrefix);
if (currentFrame == m_currentFrame) {
config.writeEntry(QStringLiteral("CurrentTab"), newPrefix);
}
}
}
}
......
......@@ -1199,23 +1199,34 @@ void MainWidget::readProperties(const KConfigGroup &config)
m_searchBar->slotSetText(config.readEntry("searchLine"));
m_searchBar->slotSetStatus(config.readEntry("searchCombo").toInt());
}
const QString currentTabName = config.readEntry("CurrentTab");
// Reopen tabs
QStringList childList = config.readEntry(QStringLiteral("Children"),
QStringList());
const QStringList childList = config.readEntry(QStringLiteral("Children"), QStringList());
int currentFrameId = -1;
Q_FOREACH (const QString &framePrefix, childList) {
WebEngineFrame *const frame = new WebEngineFrame(m_actionManager->actionCollection(), m_tabWidget);
frame->loadConfig(config, framePrefix + QLatin1Char('_'));
connectFrame(frame);
Kernel::self()->frameManager()->slotAddFrame(frame);
if (currentTabName == framePrefix) {
currentFrameId = frame->id();
}
}
if (currentFrameId != -1) {
m_tabWidget->slotSelectFrame(currentFrameId);
}
}
void MainWidget::saveProperties(KConfigGroup &config)
{
// save filter settings
config.writeEntry("searchLine", m_searchBar->text());
const QString searchStr(m_searchBar->text());
if (searchStr.isEmpty()) {
config.deleteEntry("searchLine");
} else {
config.writeEntry("searchLine", m_searchBar->text());
}
config.writeEntry("searchCombo", m_searchBar->status());
Kernel::self()->frameManager()->saveProperties(config);
......
Markdown is supported
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