diff --git a/src/mainwindow-dtk.cpp b/src/mainwindow-dtk.cpp index 9ba4da2..67a1237 100644 --- a/src/mainwindow-dtk.cpp +++ b/src/mainwindow-dtk.cpp @@ -14,6 +14,7 @@ #include #include #include +#include #define AppPageApplist 0 #define AppPageSearchlist 1 @@ -32,11 +33,11 @@ MainWindow::MainWindow(QWidget *parent) { ui->setupUi(this); - initTmpDir(); - initUI(); initConnections(); + initTmpDir(); + ui->appintopage->setDownloadWidget(downloadlistwidget); emit DGuiApplicationHelper::instance()->themeTypeChanged(DGuiApplicationHelper::instance()->themeType()); @@ -393,6 +394,28 @@ void MainWindow::initTmpDir() // 新建临时文件夹 QDir dir; dir.mkpath("/tmp/spark-store"); + + // 检查写入权限 + QFileInfo info("/tmp/spark-store"); + qDebug() << info.isWritable(); + if (info.isWritable() == false) + { + QtConcurrent::run([=] + { + sleep(3); + auto upgradeP = new QProcess(); + upgradeP->startDetached("zenity", QStringList() << "--warning" + << "--text" + << "用户未拥有 /tmp/spark-store 写入权限,星火商店会因此工作异常,请检查!" + << "--title" + << "权限受限提示" + << "--width" + << "360" + ); + upgradeP->waitForStarted(); + upgradeP->waitForFinished(30); + upgradeP->deleteLater(); }); + } } void MainWindow::switchPage(int now) // 临时方案,回家后修改