Skip to content

Commit 1373fe1

Browse files
committed
Plugins::WebBrowser: add save history
1 parent d12a6c4 commit 1373fe1

File tree

2 files changed

+15
-3
lines changed

2 files changed

+15
-3
lines changed

.github/workflows/build.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -242,7 +242,7 @@ jobs:
242242
#echo "|Linux|[AppImage](https://github.com/KangLin/RabbitRemoteControl/releases/download/${BRANCH_NAME}/RabbitRemoteControl_${{env.RabbitRemoteControl_VERSION}}_Linux_x86_64.AppImage) [Setup zip file](https://github.com/KangLin/RabbitRemoteControl/releases/download/${BRANCH_NAME}/RabbitRemoteControl_${{env.RabbitRemoteControl_VERSION}}_Linux_x86_64_Setup.zip)| |[AppImage](https://github.com/KangLin/RabbitRemoteControl/releases/download/${BRANCH_NAME}/RabbitRemoteControl_${{env.RabbitRemoteControl_VERSION}}_Linux_aarch64.AppImage) [Setup zip file](https://github.com/KangLin/RabbitRemoteControl/releases/download/${BRANCH_NAME}/RabbitRemoteControl_${{env.RabbitRemoteControl_VERSION}}_Linux_aarch64_Setup.zip)| |sudo chmod u+x RabbitRemoteControl_${{env.RabbitRemoteControl_VERSION}}_Linux_x86_64.AppImage|" >> ${{github.workspace}}/Release.md
243243
echo "|Linux|[zip file of install AppImage](https://github.com/KangLin/RabbitRemoteControl/releases/download/${BRANCH_NAME}/RabbitRemoteControl_${{env.RabbitRemoteControl_VERSION}}_Linux_x86_64_Setup.zip)| |[zip file of install AppImage](https://github.com/KangLin/RabbitRemoteControl/releases/download/${BRANCH_NAME}/RabbitRemoteControl_${{env.RabbitRemoteControl_VERSION}}_Linux_aarch64_Setup.zip)| |Unzip the zip file, then execute \`install.sh\` to install shortcuts for application, links, and directories in graphical user interfaces (GUIs), or execute \`./RabbitRemoteControl_${{env.RabbitRemoteControl_VERSION}}_Linux_x86_64.AppImage\` to run program in the terminal.|" >> ${{github.workspace}}/Release.md
244244
echo "|Ubuntu 24.04|[DEB](https://github.com/KangLin/RabbitRemoteControl/releases/download/${BRANCH_NAME}/rabbitremotecontrol_${{env.RabbitRemoteControl_VERSION}}_ubuntu-24.04_amd64.deb)| |[DEB](https://github.com/KangLin/RabbitRemoteControl/releases/download/${BRANCH_NAME}/rabbitremotecontrol_${{env.RabbitRemoteControl_VERSION}}_ubuntu-24.04-arm_arm64.deb)| |Because the system library version is too low, some functions are limited.|" >> ${{github.workspace}}/Release.md
245-
RPM_VERSION=${${{env.RabbitRemoteControl_VERSION}}//-/\~}
245+
RPM_VERSION=${RabbitRemoteControl_VERSION//-/\~}
246246
echo "|Fedora 41|[RPM](https://github.com/KangLin/RabbitRemoteControl/releases/download/${BRANCH_NAME}/rabbitremotecontrol-${RPM_VERSION}-1.fc41.x86_64.rpm)| |[RPM](https://github.com/KangLin/RabbitRemoteControl/releases/download/${BRANCH_NAME}/rabbitremotecontrol-${RPM_VERSION}-1.fc41.aarch64.rpm)| |sudo dnf install \"rpm file\" |" >> ${{github.workspace}}/Release.md
247247
248248
- name: Add download in test

Plugins/WebBrowser/FrmWebBrowser.cpp

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
#include <QSplitter>
88
#include <QVBoxLayout>
99
#include <QWebEngineProfile>
10+
#include <QWebEngineHistory>
1011
#include <QWebEngineSettings>
1112
#include <QWebEngineFindTextResult>
1213
#include <QRegularExpression>
@@ -723,9 +724,14 @@ int CFrmWebBrowser::Load(QSettings &set)
723724
int nCurrent = set.value("Current", -1).toInt();
724725
for(int i = 0; i < nCount; i++)
725726
{
726-
QString u = set.value(QString::number(i)).toString();
727+
QString u = set.value("Url/" + QString::number(i)).toString();
727728
auto pView = CreateWindow(QWebEnginePage::WebBrowserTab);
728729
pView->load(QUrl(u));
730+
731+
QByteArray history;
732+
history = set.value("History/" + QString::number(i)).toByteArray();
733+
QDataStream d(&history, QIODevice::ReadWrite);
734+
d >> *pView->history();
729735
}
730736
if(-1 < nCurrent && m_pTab->count() > nCurrent)
731737
m_pTab->setCurrentIndex(nCurrent);
@@ -740,12 +746,18 @@ int CFrmWebBrowser::Save(QSettings &set)
740746
set.beginGroup("OpenPrevious");
741747
set.setValue("Count", m_pTab->count());
742748
set.setValue("Current", m_pTab->currentIndex());
749+
743750
for(int i = 0; i < m_pTab->count(); i++) {
744751
auto v = GetView(i);
745752
if(v) {
746-
set.setValue(QString::number(i), v->url().toString());
753+
set.setValue("Url/" + QString::number(i), v->url().toString());
754+
QByteArray history;
755+
QDataStream d(&history, QIODevice::ReadWrite);
756+
d << *v->history();
757+
set.setValue("History/" + QString::number(i), history);
747758
}
748759
}
760+
749761
set.endGroup();
750762
}
751763
return 0;

0 commit comments

Comments
 (0)