⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 back.cpp

📁 天使工具,e6手机专用,大家都知道吧,狠狠好地东西,直接编译即可
💻 CPP
字号:
#include "Back.h"#include "filedialog.h"//#include "images/source_big.xpm"#include "filebrowser.h"//ezx#include <zapplication.h>#include <ezxutilcst.h>#include <zglobal.h>#include <ezxres.h>#include <zmessagebox.h>#include <zmultilineedit.h>#include <zpushbutton.h>#include "xpconfig.h"//qt//#include <qhbox.h>#include <qvbox.h>#include <qfile.h>#include <qtextstream.h>#include <qtextcodec.h>#include <stdio.h>#include <qpixmap.h>//#include <qpushbutton.h>#include <qfont.h>#include <qlayout.h>#include <qdatetime.h>//test#include <qfileinfo.h>#include <qdir.h>#include <stddef.h>#include <stdio.h>#include <stdlib.h>#include <sys/types.h>/*调用可执行文件用到的头文件*/#include <sys/wait.h>#include <sys/ioctl.h>#include <sys/socket.h>#include <unistd.h>#include <fcntl.h>QString ChineseAndEnglish(const char*ChineseString);Back::Back(bool editmode,QWidget *parent, char const *name, unsigned int flags)    : ZMainWidget(false,editmode,parent, name, flags){       getTitleBarWidget()->setText(ChineseAndEnglish("备份和恢复"));//窗口菜单    //set own content widget         QVBox *cw = new QVBox(this);  setContentWidget(cw);        //get the content widget   QVBox *vb = (QVBox*)getContentWidget(0);    mBrowser = new FileBrowser("*", vb, "browser");    mBrowser->setDir("/mmc/mmca1/.system/BackupDir/");    QObject::connect(mBrowser, SIGNAL(isFilePicked(bool)), SLOT(filePicked(bool)));        QDir d( "/mmc/mmca1/.system/BackupDir" );                            if ( !d.exists() ){			      QString  filename = "/mmc/mmca1/.system/BackupDir";       QDir f(filename);       f.mkdir(filename);     }     /*  QPushButton *backuped = new QPushButton( ChineseAndEnglish("备份"),this ,"backed");//按钮  backuped->setGeometry( 20, 200, 90, 35 );  //backuped->setFont( QFont("Times",21, QFont::Bold ) );  QPushButton *backup = new QPushButton( ChineseAndEnglish("恢复"), this,"backup");  backup->setGeometry( 130, 200, 90, 35 ); // backup->setFont( QFont("Times",21, QFont::Bold ) );        QObject::connect( backuped, SIGNAL(clicked()),SLOT( backed()) );    QObject::connect( backup, SIGNAL(clicked()), SLOT(backup()) );   */         //create CST widget创造CST窗口   UTIL_CST *cst = new UTIL_CST(this,ChineseAndEnglish("操作"));   setCSTWidget(cst);    //QWidget *cst = getCSTWidget();       mPopup = new QPopupMenu(cst, NULL);    //mPopup->insertItem(ChineseAndEnglish("关于"), AboutItem, AboutItem);    mPopup->insertItem(ChineseAndEnglish("帮助"), helpItem, helpItem);    QObject::connect(mPopup, SIGNAL(activated(int)), SLOT(selectMenu(int)));          // mPopup = cst->getLeftBtn();   ZPushButton *bt1 = new ZPushButton(cst, 1, 0, 0);	ZPushButton *bt2 = new ZPushButton(cst, 1, 0, 0);	ZPushButton *bt3 = new ZPushButton(cst, 1, 0, 0);	ZPushButton *bt4 = new ZPushButton(cst, 1, 0, 0);		bt1->setGeometry(ZGlobal::mapFromGlobalR(bt1, ZGlobal::getCst4b_1R())); bt1->setResourceID("CST_Menu");	bt2->setGeometry(ZGlobal::mapFromGlobalR(bt2, ZGlobal::getCst4b_2R())); bt2->setText(ChineseAndEnglish("备份"));	bt3->setGeometry(ZGlobal::mapFromGlobalR(bt3, ZGlobal::getCst4b_3R())); bt3->setText(ChineseAndEnglish("恢复"));	bt4->setGeometry(ZGlobal::mapFromGlobalR(bt4, ZGlobal::getCst4b_4R())); bt4->setResourceID("CST_Exit");   bt1->setPopup(mPopup);	QObject::connect(bt2, SIGNAL(clicked()), this, SLOT(backed()));	QObject::connect(bt3, SIGNAL(clicked()), this, SLOT(backup()));	QObject::connect(bt4, SIGNAL(clicked()), this, SLOT(close()));       }Back::~Back(){} void Back::selectMenu(int idx){   // if (idx == AboutItem) {     //   showAboutDialog();    //}  else     if (idx == helpItem) {         help();    } }void Back::backed(){       QDate date = QDate::currentDate();   QString s;    s.sprintf( "%4d-%d-%d",date.year(), date.month(), date.day() );     RES_ICON_Reader ir;        switch (ZMessageBox::information(this,            ir.getIcon(RES_ICON_DLG_WAITING,1),            ChineseAndEnglish("现在就要备份为,E6-%1.bck 你想继续吗?").arg(s),            ChineseAndEnglish("备份"), ChineseAndEnglish("取消")) )             {        case 0: // save 	 			system("/bin/tar czf /mmc/mmca1/.system/BackupDir/E6-"+s+".bck /ezxlocal/download/appwrite/phone /ezxlocal/.system/mms/mailfile /ezx_user/download/appwrite/setup /ezx_user/download/appwrite/am /ezx_user/download/appwrite/rights /ezx_user/sysDatabase/");			  ZMessageBox::timerMessage(this,           ir.getIcon(RES_ICON_DLG_COMPLETE,1),           ChineseAndEnglish("备份成功..."), 2);          mBrowser->setDir("/mmc/mmca1/.system/BackupDir/");                  break;                default: // cancel            return;            break;      }        }void Back::backup() {		QString fileName = mBrowser->getFileName();    RES_ICON_Reader ir;        switch (ZMessageBox::information(this,            ir.getIcon(RES_ICON_DLG_WAITING,1),            ChineseAndEnglish("现在就要恢复%1 请使用机器原来的主题,成功后要重起一下。你想继续吗?").arg(fileName),            ChineseAndEnglish("恢复"), ChineseAndEnglish("取消")) )             {        case 0: // save 					if( fileName.right(3) == "bck"){			system("/bin/kill -9 `pidof db_daemon`");			system("/bin/rm -rf /ezx_user/sysDatabase/*");			system("/bin/tar xzf "+fileName+" -C /");			system("/bin/chmod 666 /ezx_user/sysDatabase/*");									ZMessageBox::timerMessage(this,         ir.getIcon(RES_ICON_DLG_COMPLETE,1),         ChineseAndEnglish("成功恢复,将重起你的手机..."), 2);       }			system("start-stop-daemon -S -c root -x /sbin/reboot");       break;              default: // cancel        return;        break;   }		}void Back::help(){	ZMessageBox::information(        this,NULL,        QString(ChineseAndEnglish("<qt><p><b>备份和恢复的说明</b><p>"        "具体备份的文件信息是:<br>"        "  电话本(包括分组,单独来电铃声,来电图片)"        "短信息,彩信,手机里的mpkg.java文件,"        "内存版主题,书签,上网设置,及其他各方面设置."        "备份是在SD卡上的,没有的就不要做。"        "<b></qt>")),        ChineseAndEnglish("关闭"));			}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -