QT3 -> QT4

git-svn-id: https://svn.code.sf.net/p/keepassx/code/trunk@5 b624d157-de02-0410-bad0-e51aec6abb33
This commit is contained in:
tariq
2005-11-15 20:45:14 +00:00
parent 192dbba0e4
commit 28c71dfe1e
51 changed files with 977 additions and 937 deletions

View File

@@ -21,9 +21,9 @@
void CPwmTime::Set(unsigned char* pBytes){
UINT32 dw1, dw2, dw3, dw4, dw5;
dw1 = (UINT32)pBytes[0]; dw2 = (UINT32)pBytes[1]; dw3 = (UINT32)pBytes[2];
dw4 = (UINT32)pBytes[3]; dw5 = (UINT32)pBytes[4];
Q_UINT32 dw1, dw2, dw3, dw4, dw5;
dw1 = (Q_UINT32)pBytes[0]; dw2 = (Q_UINT32)pBytes[1]; dw3 = (Q_UINT32)pBytes[2];
dw4 = (Q_UINT32)pBytes[3]; dw5 = (Q_UINT32)pBytes[4];
// Unpack 5 byte structure to date and time
///@FIXME nicht Endian-sicher
Year = (dw1 << 6) | (dw2 >> 2);
@@ -36,14 +36,14 @@ Second = dw5 & 0x0000003F;
void CPwmTime::GetPackedTime(unsigned char* pBytes){
///@FIXME nicht Endian-sicher
pBytes[0] = (UINT8)(((UINT32)Year >> 6) & 0x0000003F);
pBytes[1] = (UINT8)((((UINT32)Year & 0x0000003F) << 2) | (((UINT32)Month >> 2) & 0x00000003));
pBytes[2] = (UINT8)((((UINT32)Month & 0x00000003) << 6) | (((UINT32)Day & 0x0000001F) << 1) | (((UINT32)Hour >> 4) & 0x00000001));
pBytes[3] = (UINT8)((((UINT32)Hour & 0x0000000F) << 4) | (((UINT32)Minute >> 2) & 0x0000000F));
pBytes[4] = (UINT8)((((UINT32)Minute & 0x00000003) << 6) | ((UINT32)Second & 0x0000003F));
pBytes[0] = (Q_UINT8)(((Q_UINT32)Year >> 6) & 0x0000003F);
pBytes[1] = (Q_UINT8)((((Q_UINT32)Year & 0x0000003F) << 2) | (((Q_UINT32)Month >> 2) & 0x00000003));
pBytes[2] = (Q_UINT8)((((Q_UINT32)Month & 0x00000003) << 6) | (((Q_UINT32)Day & 0x0000001F) << 1) | (((Q_UINT32)Hour >> 4) & 0x00000001));
pBytes[3] = (Q_UINT8)((((Q_UINT32)Hour & 0x0000000F) << 4) | (((Q_UINT32)Minute >> 2) & 0x0000000F));
pBytes[4] = (Q_UINT8)((((Q_UINT32)Minute & 0x00000003) << 6) | ((Q_UINT32)Second & 0x0000003F));
}
QString CPwmTime::GetString(UINT16 format){
QString CPwmTime::GetString(Q_UINT16 format){
QString str;
switch(format){
case 0:
@@ -88,7 +88,7 @@ str=str.arg(Second);}
return str;
}
void CPwmTime::Set(UINT8 iDay,UINT8 iMonth,UINT16 iYear,UINT8 iHour,UINT8 iMinute,UINT8 iSecond){
void CPwmTime::Set(Q_UINT8 iDay,Q_UINT8 iMonth,Q_UINT16 iYear,Q_UINT8 iHour,Q_UINT8 iMinute,Q_UINT8 iSecond){
Day=iDay;
Month=iMonth;
Year=iYear;

View File

@@ -25,15 +25,15 @@
class CPwmTime;
class CPwmTime{
public:
UINT16 Year;
UINT8 Month;
UINT8 Day;
UINT8 Hour;
UINT8 Minute;
UINT8 Second;
Q_UINT16 Year;
Q_UINT8 Month;
Q_UINT8 Day;
Q_UINT8 Hour;
Q_UINT8 Minute;
Q_UINT8 Second;
QString GetString(UINT16 format);
void Set(UINT8,UINT8,UINT16,UINT8,UINT8,UINT8);
QString GetString(Q_UINT16 format);
void Set(Q_UINT8,Q_UINT8,Q_UINT16,Q_UINT8,Q_UINT8,Q_UINT8);
void Set(unsigned char* packedTime);
void GetPackedTime(unsigned char* dst);
static bool IsValidDate(QString& string);
@@ -48,4 +48,4 @@ public:
};
#endif
#endif

View File

@@ -23,7 +23,7 @@
#include <iostream.h>
#include "random.h"
UINT8 SecString::Key[32]={0};
Q_UINT8 SecString::Key[32]={0};
SecString::SecString(){
data=NULL;
@@ -102,4 +102,4 @@ return len;
void SecString::generateSessionKey(){
getRandomBytes(Key,32,1,false);
}
}

View File

@@ -40,7 +40,7 @@ public:
static void generateSessionKey();
private:
static UINT8 Key[32];
static Q_UINT8 Key[32];
QString plaintext;
char* data;
int len;
@@ -48,4 +48,4 @@ private:
};
#endif
#endif

View File

@@ -24,12 +24,15 @@
#include <qcolor.h>
#include <qcursor.h>
#include <qfontmetrics.h>
//Added by qt3to4:
#include <QMouseEvent>
#include <QLabel>
LinkLabel::LinkLabel(QWidget *parent, const char* name,const QString& text, int x, int y,WFlags f) : QLabel(parent,name,f){
LinkLabel::LinkLabel(QWidget *parent, const char* name,const QString& text, int x, int y,Qt::WFlags f) : QLabel(parent,name,f){
QFont font(parentWidget()->font()); font.setUnderline(true);
setFont(font);
setPaletteForegroundColor(QColor(20,20,255));
setCursor(PointingHandCursor);
setCursor(Qt::PointingHandCursor);
setText(text);
setPos(x,y);
}
@@ -39,7 +42,7 @@ LinkLabel::~LinkLabel(){
}
void LinkLabel::mouseReleaseEvent(QMouseEvent* event){
if(event->button()==LeftButton)
if(event->button()==Qt::LeftButton)
clicked();
}

View File

@@ -21,12 +21,14 @@
#ifndef _LINKLABEL_H_
#define _LINKLABEL_H_
#include <qlabel.h>
#include <qsignal.h>
#include <q3signal.h>
//Added by qt3to4:
#include <QMouseEvent>
class LinkLabel : public QLabel{
Q_OBJECT
public:
LinkLabel(QWidget *parent, const char* name = 0,const QString& text=QString::null, int x=0, int y=0,WFlags f=0);
LinkLabel(QWidget *parent, const char* name = 0,const QString& text=QString::null, int x=0, int y=0,Qt::WFlags f=0);
~LinkLabel();
void setPos(int x,int y);

View File

@@ -31,11 +31,11 @@ else{
dev_random = fopen("/dev/urandom","r");}
if (dev_random==NULL){
cout << QObject::tr("/dev/random konnte nicht geöffnet werden - nutze Standardbibliothek (stdlib)") << endl;
qWarning(QObject::tr("/dev/random konnte nicht geöffnet werden - nutze Standardbibliothek (stdlib)")+"\n");
srand(QTime(0,0,0).secsTo(QTime::currentTime()));
for(int i=0;i<NumBlocks*BlockSize;i++){
UINT8 rnd=rand()%256;
((UINT8*)buffer)[i]=rnd;
Q_UINT8 rnd=rand()%256;
((Q_UINT8*)buffer)[i]=rnd;
}
return;
}
@@ -44,4 +44,4 @@ fread(buffer,BlockSize,NumBlocks,dev_random);
fclose(dev_random);
return;
}
}
}