Feat:Add cloud sync interface.
This commit is contained in:
parent
8e9b51ea2b
commit
9b7bcf54c6
|
@ -141,6 +141,85 @@ QStringList GlobalSettings::getBlockDirs()
|
||||||
return m_block_dirs_settings->allKeys();
|
return m_block_dirs_settings->allKeys();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void GlobalSettings::appendCloudData(const QString &key, const QString &value)
|
||||||
|
{
|
||||||
|
QSettings * m_qSettings = new QSettings(CLOUD_FILE, QSettings::IniFormat);
|
||||||
|
m_qSettings->beginGroup(key);
|
||||||
|
QStringList values = m_qSettings->value(key).toStringList();
|
||||||
|
m_qSettings->endGroup();
|
||||||
|
if (values.contains(value)) {
|
||||||
|
values.removeOne(value);
|
||||||
|
}
|
||||||
|
values.insert(0,value);
|
||||||
|
|
||||||
|
m_qSettings->beginGroup(key);
|
||||||
|
m_qSettings->setValue(key, values);
|
||||||
|
m_qSettings->endGroup();
|
||||||
|
if (m_qSettings) {
|
||||||
|
delete m_qSettings;
|
||||||
|
m_qSettings = NULL;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void GlobalSettings::setCloudData(const QString &key, const QStringList &values)
|
||||||
|
{
|
||||||
|
QSettings * m_qSettings = new QSettings(CLOUD_FILE, QSettings::IniFormat);
|
||||||
|
m_qSettings->beginGroup(key);
|
||||||
|
m_qSettings->setValue(key, values);
|
||||||
|
m_qSettings->endGroup();
|
||||||
|
if (m_qSettings) {
|
||||||
|
delete m_qSettings;
|
||||||
|
m_qSettings = NULL;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
bool GlobalSettings::removeOneCloudData(const QString &key, const QString &value)
|
||||||
|
{
|
||||||
|
if (!QFileInfo(CLOUD_FILE).isFile()) return false;
|
||||||
|
QSettings * m_qSettings = new QSettings(CLOUD_FILE, QSettings::IniFormat);
|
||||||
|
m_qSettings->beginGroup(key);
|
||||||
|
QStringList values = m_qSettings->value(key).toStringList();
|
||||||
|
m_qSettings->endGroup();
|
||||||
|
if (values.contains(value)) {
|
||||||
|
values.removeOne(value);
|
||||||
|
} else return false;
|
||||||
|
m_qSettings->beginGroup(key);
|
||||||
|
m_qSettings->setValue(key, values);
|
||||||
|
m_qSettings->endGroup();
|
||||||
|
if (m_qSettings) {
|
||||||
|
delete m_qSettings;
|
||||||
|
m_qSettings = NULL;
|
||||||
|
}
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool GlobalSettings::removeAllCloudData(const QString &key)
|
||||||
|
{
|
||||||
|
if (!QFileInfo(CLOUD_FILE).isFile()) return false;
|
||||||
|
QSettings * m_qSettings = new QSettings(CLOUD_FILE, QSettings::IniFormat);
|
||||||
|
m_qSettings->beginGroup(key);
|
||||||
|
m_qSettings->beginGroup(key);
|
||||||
|
m_qSettings->setValue(key, QStringList());
|
||||||
|
m_qSettings->endGroup();
|
||||||
|
if (m_qSettings) {
|
||||||
|
delete m_qSettings;
|
||||||
|
m_qSettings = NULL;
|
||||||
|
}
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
QStringList GlobalSettings::getCloudData(const QString &key)
|
||||||
|
{
|
||||||
|
if (!QFileInfo(CLOUD_FILE).isFile()) return QStringList();
|
||||||
|
QSettings * m_qSettings = new QSettings(CLOUD_FILE, QSettings::IniFormat);
|
||||||
|
m_qSettings->beginGroup(key);
|
||||||
|
QStringList values = m_qSettings->value(key).toStringList();
|
||||||
|
m_qSettings->endGroup();
|
||||||
|
if(m_qSettings)
|
||||||
|
delete m_qSettings;
|
||||||
|
return values;
|
||||||
|
}
|
||||||
|
|
||||||
//here should be override
|
//here should be override
|
||||||
//MouseZhangZh
|
//MouseZhangZh
|
||||||
void GlobalSettings::setValue(const QString &key, const QVariant &value)
|
void GlobalSettings::setValue(const QString &key, const QVariant &value)
|
||||||
|
|
|
@ -25,6 +25,7 @@
|
||||||
#include <QSettings>
|
#include <QSettings>
|
||||||
#include <QMutex>
|
#include <QMutex>
|
||||||
#include <QVector>
|
#include <QVector>
|
||||||
|
#include <QDir>
|
||||||
//#include <QGSettings>
|
//#include <QGSettings>
|
||||||
//If use pkg_config, it wont build succes,why?????????
|
//If use pkg_config, it wont build succes,why?????????
|
||||||
//My demo can build access yet.
|
//My demo can build access yet.
|
||||||
|
@ -43,6 +44,10 @@
|
||||||
#define PATH_NOT_IN_HOME 2;
|
#define PATH_NOT_IN_HOME 2;
|
||||||
#define PATH_PARENT_BLOCKED 3;
|
#define PATH_PARENT_BLOCKED 3;
|
||||||
|
|
||||||
|
#define CLOUD_FILE QDir::homePath() + "/.config/org.ukui/ukui-search/ukui-search-cloud.conf"
|
||||||
|
#define CLOUD_HISTORY "history"
|
||||||
|
#define CLOUD_APPLICATIONS "applications"
|
||||||
|
|
||||||
class LIBSEARCH_EXPORT GlobalSettings : public QObject
|
class LIBSEARCH_EXPORT GlobalSettings : public QObject
|
||||||
{
|
{
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
|
@ -69,6 +74,11 @@ public Q_SLOTS:
|
||||||
*/
|
*/
|
||||||
bool setBlockDirs(const QString& path, int &returnCode,bool remove = false);
|
bool setBlockDirs(const QString& path, int &returnCode,bool remove = false);
|
||||||
QStringList getBlockDirs();
|
QStringList getBlockDirs();
|
||||||
|
void appendCloudData(const QString& key, const QString& value);
|
||||||
|
void setCloudData(const QString& key, const QStringList& values);
|
||||||
|
bool removeOneCloudData(const QString& key, const QString& value);
|
||||||
|
bool removeAllCloudData(const QString& key);
|
||||||
|
QStringList getCloudData(const QString& key);
|
||||||
|
|
||||||
void forceSync(const QString& = nullptr);
|
void forceSync(const QString& = nullptr);
|
||||||
|
|
||||||
|
|
|
@ -6016,7 +6016,7 @@ feng 仹
|
||||||
cang 仺
|
cang 仺
|
||||||
ren,lin 任
|
ren,lin 任
|
||||||
wang 仼
|
wang 仼
|
||||||
bin,fen 份
|
fen 份
|
||||||
di 仾
|
di 仾
|
||||||
fang,pang 仿
|
fang,pang 仿
|
||||||
zhong 伀
|
zhong 伀
|
||||||
|
@ -6221,7 +6221,7 @@ xu,shu 俆
|
||||||
guang 俇
|
guang 俇
|
||||||
ku 俈
|
ku 俈
|
||||||
wu 俉
|
wu 俉
|
||||||
dun,jun,shun 俊
|
jun 俊
|
||||||
yi 俋
|
yi 俋
|
||||||
fu 俌
|
fu 俌
|
||||||
liang,lang 俍
|
liang,lang 俍
|
||||||
|
@ -11420,7 +11420,7 @@ zhi 搘
|
||||||
nuo,nou,nu 搙
|
nuo,nou,nu 搙
|
||||||
la,xie,xian 搚
|
la,xie,xian 搚
|
||||||
lian,jian 搛
|
lian,jian 搛
|
||||||
shao,xiao,sou 搜
|
sou 搜
|
||||||
qiu 搝
|
qiu 搝
|
||||||
qiao,gao,kao 搞
|
qiao,gao,kao 搞
|
||||||
xian 搟
|
xian 搟
|
||||||
|
|
|
@ -137,7 +137,12 @@ void SearchDetailView::setWebWidget(const QString& keyword)
|
||||||
|
|
||||||
connect(m_webView,&QWebEngineView::loadFinished, this, [ = ](){
|
connect(m_webView,&QWebEngineView::loadFinished, this, [ = ](){
|
||||||
m_reload = true;
|
m_reload = true;
|
||||||
if (m_engineProfile) m_engineProfile->clearHttpCache();
|
if (m_engineProfile){
|
||||||
|
m_engineProfile->clearHttpCache(); // 清理缓存
|
||||||
|
m_engineProfile->clearAllVisitedLinks(); // 清理浏览记录
|
||||||
|
m_engineProfile->cookieStore()->deleteAllCookies(); // 清理cookie
|
||||||
|
m_engineProfile->cookieStore()->deleteSessionCookies(); // 清理会话cookie
|
||||||
|
}
|
||||||
});
|
});
|
||||||
connect(m_webView, &QWebEngineView::urlChanged, this, [ = ](const QUrl& url) {
|
connect(m_webView, &QWebEngineView::urlChanged, this, [ = ](const QUrl& url) {
|
||||||
if (m_reload) {
|
if (m_reload) {
|
||||||
|
|
|
@ -49,6 +49,10 @@ SearchListView::SearchListView(QWidget * parent, const QStringList& list, const
|
||||||
Q_EMIT this->currentRowChanged(getCurrentType(), m_item->m_pathlist.at(this->currentIndex().row()));
|
Q_EMIT this->currentRowChanged(getCurrentType(), m_item->m_pathlist.at(this->currentIndex().row()));
|
||||||
m_isSelected = true;
|
m_isSelected = true;
|
||||||
});
|
});
|
||||||
|
|
||||||
|
connect(this, &SearchListView::doubleClicked, this, [ = ](const QModelIndex& index) {
|
||||||
|
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
SearchListView::~SearchListView()
|
SearchListView::~SearchListView()
|
||||||
|
|
Loading…
Reference in New Issue