#include "rename_page.h"
|
#include "ui_rename_page.h"
|
#include "Common/app_define.h"
|
#include "IMEKeyBoard/syszuxpinyin.h"
|
|
ReName_Page::ReName_Page(QWidget *parent, QString name, Work_Thread *thread) :
|
customDialog(parent),
|
ui(new Ui::ReName_Page)
|
{
|
ui->setupUi(this);
|
work_thread = thread;
|
set_btn_beep(ui->edit_newName,SIGNAL(custom_click()));
|
set_btn_beep(ui->pushButton_Exit,SIGNAL(pressed()));
|
set_btn_beep(ui->pushButton_OK,SIGNAL(pressed()));
|
|
connect(ui->edit_newName,SIGNAL(custom_click()),this,SLOT(CustomEditSlot()));
|
connect(ui->pushButton_Exit,SIGNAL(released()),this,SLOT(RenameBtnSlot()));
|
connect(ui->pushButton_OK,SIGNAL(released()),this,SLOT(RenameBtnSlot()));
|
|
oldName = name;
|
ui->label_oldName->setText(oldName);
|
}
|
|
ReName_Page::~ReName_Page()
|
{
|
delete ui;
|
}
|
|
void ReName_Page::RenameBtnSlot()
|
{
|
QPushButton *pb = dynamic_cast<QPushButton*>(sender());
|
if(ui->pushButton_Exit == pb)
|
{
|
closeCustom(false);
|
}
|
else if(ui->pushButton_OK == pb)
|
{
|
newName = ui->edit_newName->text();
|
rename_action();
|
closeCustom(false);
|
}
|
}
|
|
void ReName_Page::CustomEditSlot()
|
{
|
ui->edit_newName->setStyleSheet("color:red");
|
// KeyBoard_CN keyboard(this,ui->edit_newName,true);
|
// keyboard.setGeometry(0,100,800,380);
|
// keyboard.execKeyboard();
|
SyszuxPinyin pinyin(this,ui->edit_newName,work_thread);
|
pinyin.exec();
|
ui->edit_newName->setStyleSheet("color:black");
|
}
|
|
void ReName_Page::rename_action()
|
{
|
fileManage.renameDir(dataDir+oldName,dataDir+newName);
|
}
|