修复全名重复
parent
fd525fb8d1
commit
a96f802b85
|
@ -119,13 +119,15 @@ void ApplicationManager::onclick1(QString op, QString func, QString path, QStrin
|
||||||
add_app.exec();
|
add_app.exec();
|
||||||
if(add_app.changed)
|
if(add_app.changed)
|
||||||
{
|
{
|
||||||
bool ok = sqlite_helper.insert_software(add_app.get_name(), add_app.get_orig_name(), add_app.get_exe_path(),
|
int ok = sqlite_helper.insert_software(add_app.get_name(), add_app.get_orig_name(), add_app.get_exe_path(),
|
||||||
add_app.get_sort(), add_app.get_categories());
|
add_app.get_sort(), add_app.get_categories());
|
||||||
if (!ok)
|
if (!ok)
|
||||||
{
|
{
|
||||||
QMessageBox::critical(this, QString::fromLocal8Bit("错误"), QString::fromLocal8Bit("插入失败,全名是否重名?"));
|
QMessageBox::critical(this, QString::fromLocal8Bit("错误"), QString::fromLocal8Bit("插入失败。"));
|
||||||
|
}else if(ok==FIND)
|
||||||
|
{
|
||||||
|
QMessageBox::critical(this, QString::fromLocal8Bit("错误"), QString::fromLocal8Bit("已存在。"));
|
||||||
}
|
}
|
||||||
|
|
||||||
emit refresh_tab();
|
emit refresh_tab();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -43,4 +43,6 @@
|
||||||
#define CUSTOM_2 7
|
#define CUSTOM_2 7
|
||||||
#define OTHERS 8
|
#define OTHERS 8
|
||||||
#define CATEGORIES_NUM 8
|
#define CATEGORIES_NUM 8
|
||||||
|
|
||||||
|
#define FIND 2
|
||||||
#endif //OFFICEASSISTANT_CONFIG_H
|
#endif //OFFICEASSISTANT_CONFIG_H
|
||||||
|
|
|
@ -139,4 +139,11 @@ public:
|
||||||
OpenWeChatRequest():RequestBodyBase(){}
|
OpenWeChatRequest():RequestBodyBase(){}
|
||||||
QString sendRequest(bool notuse=false/*为了构成函数重载,凑数的*/);
|
QString sendRequest(bool notuse=false/*为了构成函数重载,凑数的*/);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
class OpenAppRequest:public RequestBodyBase
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
OpenAppRequest():RequestBodyBase(){}
|
||||||
|
QString sendRequest(QString app_name);
|
||||||
|
};
|
||||||
#endif //OFFICEASSISTANT_NETIO_H
|
#endif //OFFICEASSISTANT_NETIO_H
|
||||||
|
|
|
@ -1340,10 +1340,21 @@ bool SQLiteHelper::insert_software(QString name, QString orig_name, QString path
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
bool SQLiteHelper::insert_software(QString name, QString orig_name, QString path, QString sort, bool* categories) {
|
int SQLiteHelper::insert_software(QString name, QString orig_name, QString path, QString sort, bool* categories) {
|
||||||
QSqlQuery begin(db);
|
QSqlQuery begin(db);
|
||||||
begin.exec("BEGIN;");
|
begin.exec("BEGIN;");
|
||||||
|
QSqlQuery select;
|
||||||
QSqlQuery query(db);
|
QSqlQuery query(db);
|
||||||
|
QSqlQuery query_sel(db);
|
||||||
|
QString sql_sel = "select id from kmd_menu where orig_name = :orig_name;";
|
||||||
|
query_sel.prepare(sql_sel);
|
||||||
|
query_sel.bindValue(":orig_name", orig_name);
|
||||||
|
if(query_sel.exec())
|
||||||
|
{
|
||||||
|
if(query_sel.next()){
|
||||||
|
return FIND;
|
||||||
|
}
|
||||||
|
}
|
||||||
QString categories_str = "";
|
QString categories_str = "";
|
||||||
categories[ALL - 1] = true;
|
categories[ALL - 1] = true;
|
||||||
QString sql = "insert into kmd_menu "
|
QString sql = "insert into kmd_menu "
|
||||||
|
|
|
@ -52,7 +52,7 @@ public:
|
||||||
SQLiteHelper(QObject *parent = nullptr);
|
SQLiteHelper(QObject *parent = nullptr);
|
||||||
bool update_software();
|
bool update_software();
|
||||||
bool insert_software(QString name, QString orig_name, QString path, QString sort, bool* categories, QString logo, QString img,QString type,bool locked,QString op,QString func,QString url,bool is_navbar,bool is_elite,QString dev);
|
bool insert_software(QString name, QString orig_name, QString path, QString sort, bool* categories, QString logo, QString img,QString type,bool locked,QString op,QString func,QString url,bool is_navbar,bool is_elite,QString dev);
|
||||||
bool insert_software(QString name, QString orig_name, QString path, QString sort, bool* categories);
|
int insert_software(QString name, QString orig_name, QString path, QString sort, bool* categories);
|
||||||
bool edit_software(QString name, QString orig_name, QString path, QString sort, bool* categories,QString type="");
|
bool edit_software(QString name, QString orig_name, QString path, QString sort, bool* categories,QString type="");
|
||||||
bool get_software(QList<ButtonStruct>* buttons, ConfigResponse* config_response);
|
bool get_software(QList<ButtonStruct>* buttons, ConfigResponse* config_response);
|
||||||
bool get_software(QList<ButtonStruct>* button_structs,QString background_color , QString title_color, QString title_cover_color);
|
bool get_software(QList<ButtonStruct>* button_structs,QString background_color , QString title_color, QString title_cover_color);
|
||||||
|
|
Loading…
Reference in New Issue