menuBar()->addMenu(FileMenu);
EditMenu=new QMenu(trUtf8("&Button", "top menu"));
EditMenu->addAction(trUtf8("&Download", "Button|Downlad"), this, SLOT(downloadData()),QKeySequence(trUtf8("Ctrl+W", "Button|Downlad")));
- EditMenu->addAction(trUtf8("A&dd", "Button|Add"), this, SLOT(addDB()), QKeySequence(trUtf8("Ctrl+D", "Button|Add")));
+ //EditMenu->addAction(trUtf8("A&dd", "Button|Add"), this, SLOT(addDB()), QKeySequence(trUtf8("Ctrl+D", "Button|Add")));
EditMenu->addAction(trUtf8("Sa&v", "Button|Sav"), this, SLOT(savData()), QKeySequence(trUtf8("Ctrl+V", "Button|Save")));
//EditMenu->addAction(trUtf8("Reset", "Button|Reset"), this, SLOT(reset()), QKeySequence(trUtf8("Ctrl+Z", "Button|Reset")));
- EditMenu->addAction(trUtf8("&Edit", "Button|Edit"), this, SLOT(chooseDB()), QKeySequence(trUtf8("Ctrl+E", "Button|&Edit")));
+ //EditMenu->addAction(trUtf8("&Edit", "Button|Edit"), this, SLOT(chooseDB()), QKeySequence(trUtf8("Ctrl+E", "Button|&Edit")));
menuBar()->addMenu(EditMenu);
HackMenu=new QMenu(trUtf8("&Hack", "top menu"));
HackMenu->addAction(trUtf8("New entry", "Hack|Entry"), this, SLOT(entry()));
qDebug()<<"addDB";
if(deb)QMessageBox::information(this, trUtf8("addDB", "box title to debug addDB"), "type : "+tmp);
bool ok=0;
- QString cur=label->text();
+ QString cur=beforekey;
QString a, b, c=QInputDialog::getText(this, trUtf8("label", "Title of box where ask for new label"), trUtf8("Enter his label", "his/her/?they? I've forget my school lesson"), QLineEdit::Normal, QString(""), &ok);
if ((c=="")||(ok==0))return;
b=QInputDialog::getText(this, trUtf8("keyword", "Title of box where ask for new keyword"), trUtf8("Enter they keyword (no limit !)"), QLineEdit::Normal, cur, &ok);
QString b;
bool ok=1;
if(conf->value("askkeyword").toBool())b=QInputDialog::getText(this, trUtf8("chooseDB"), trUtf8("Enter the keyword : "), QLineEdit::Normal, label->text(), &ok);
- else b=label->text();
+ else b=beforekey;
if(ok)chooseDB(conf->value(QString("currenttype")).toString(), b);
}
void MainWindow::chooseDB(const QString & b){
if (k==Qt::Key_Menu){
const QString a=conf->value(QString("actionmenu"), QString("")).toString();
if(a!=""){
- action(a);
+ if(beforekey.isEmpty()){
+ beforekey=lastprint;
+ action(a);
+ }else{
+ action(beforekey);
+ beforekey.clear();
+ };
accepted=true;
- }
}
+ }
else if(k==Qt::Key_Back){
const QString a=conf->value(QString("menuback"), QString("")).toString();
if(a!=""){
- action(a);
+ if(beforekey.isEmpty()){
+ beforekey=lastprint;
+ action(a);
+ }else{
+ action(beforekey);
+ beforekey.clear();
+ };
accepted=true;
- }
}
+ }
else if(k==Qt::Key_VolumeDown){
qDebug()<<"keyvolumdown";
const QString a=conf->value(QString("volumdown")).toString();
if(a!=""){
- action(a);
+ if(beforekey.isEmpty()){
+ beforekey=lastprint;
+ action(a);
+ }else{
+ action(beforekey);
+ beforekey.clear();
+ };
accepted=true;
- }
}
+ }
else if(k==Qt::Key_VolumeUp){
const QString a=conf->value(QString("volumup")).toString();
if(a!=""){
- action(a);
+ if(beforekey.isEmpty()){
+ beforekey=lastprint;
+ action(a);
+ }else{
+ action(beforekey);
+ beforekey.clear();
+ };
accepted=true;
- }
- };
+ }
+ };
event->setAccepted(accepted);
}
void CLabel::SetTextToLabel(const QString& text)
Q_OBJECT
public:
explicit FileDownloader(QUrl url, QObject *parent = 0);
-
virtual ~FileDownloader();
-
QByteArray downloadedData() const;
-
signals:
void downloaded();
-
private slots:
-
void fileDownloaded(QNetworkReply* pReply);
-
private:
-
QNetworkAccessManager m_WebCtrl;
-
QByteArray m_DownloadedData;
-
};
-
#endif // FILEDOWNLOADER_H
-
class CLabel : public QLabel
{
Q_OBJECT
QString m_style;
QSettings * settings;
-
public:
explicit CLabel(const QString&, const QSettings &, QWidget * parent = 0 );
~CLabel();
void pressed();
void released();
private slots:
-
protected:
void mousePressEvent ( QMouseEvent * event ) ;
void mouseReleaseEvent(QMouseEvent * event ) ;
bool printItem(const QSqlQuery &);
//void shellReady();a desperated attempt to get the output of my cmd, i've try Qprocess (but don't get it)
public slots:
-
signals:
void datafilled();
void writed();
QGridLayout *grid;
QLabel *label;
QSettings *conf;
- QString tmp, tmp2, file, lastprint, currenttype, savtitle;//host, user, tmp, password, servercert,database;
+ QString tmp, tmp2, file, lastprint, currenttype, savtitle, beforekey;//host, user, tmp, password, servercert,database;
QMenu *FileMenu, *EditMenu, *HackMenu;
QSignalMapper *signalmap;
QStringList way;