replaced Q_UINT with quint
git-svn-id: https://svn.code.sf.net/p/keepassx/code/trunk@80 b624d157-de02-0410-bad0-e51aec6abb33
This commit is contained in:
@@ -365,7 +365,6 @@ else
|
||||
void CEditEntryDlg::OnCustomIcons(){
|
||||
CSelectIconDlg dlg(db,Combo_IconPicker->currentItem(),this);
|
||||
int r=dlg.exec();
|
||||
if(dlg.ModFlag)ModFlag=true;
|
||||
if(r!=-1){
|
||||
Combo_IconPicker->clear();
|
||||
for(int i=0;i<db->numIcons();i++)
|
||||
|
||||
@@ -69,7 +69,6 @@ done(0);
|
||||
void CEditGroupDialog::OnIconDlg(){
|
||||
CSelectIconDlg dlg(db,IconID,this);
|
||||
int r=dlg.exec();
|
||||
if(dlg.ModFlag)ModFlag=true;
|
||||
if(r!=-1){
|
||||
ComboIconPicker->clear();
|
||||
for(int i=0;i<db->numIcons();i++)
|
||||
|
||||
@@ -30,7 +30,7 @@ public:
|
||||
CSearchDlg(Database* _db, CGroup* pGroup=NULL,QWidget* parent = 0, const char* name = 0,
|
||||
bool modal = FALSE, Qt::WFlags fl = 0 );
|
||||
~CSearchDlg();
|
||||
QList<Q_UINT32> Hits;
|
||||
QList<quint32> Hits;
|
||||
|
||||
public slots:
|
||||
virtual void OnButtonClose();
|
||||
|
||||
@@ -32,15 +32,16 @@ CSelectIconDlg::CSelectIconDlg(Database* database,int CurrentID,QWidget* parent,
|
||||
setupUi(this);
|
||||
db=database;
|
||||
CtxMenu=new QMenu(this);
|
||||
ReplaceAction=CtxMenu->addAction(*Icon_Swap,tr("Replace..."));
|
||||
DeleteAction=CtxMenu->addAction(*Icon_EditDelete,tr("Delete"));
|
||||
connect(Button_AddIcon, SIGNAL(clicked()), this, SLOT(OnAddIcon()));
|
||||
connect(Button_PickIcon, SIGNAL(clicked()), this, SLOT(OnPickIcon()));
|
||||
connect(Button_Cancel, SIGNAL(clicked()), this, SLOT(OnCancel()));
|
||||
connect(DeleteAction,SIGNAL(triggered()),this,SLOT(OnDelete()));
|
||||
connect(ReplaceAction,SIGNAL(triggered()),this,SLOT(OnReplace()));
|
||||
connect(List,SIGNAL(currentItemChanged(QListWidgetItem*,QListWidgetItem*)),this,SLOT(OnSelectionChanged(QListWidgetItem*,QListWidgetItem*)));
|
||||
updateView();
|
||||
List->setCurrentItem(List->item(CurrentID));
|
||||
ModFlag=false;
|
||||
}
|
||||
|
||||
void CSelectIconDlg::updateView(){
|
||||
@@ -60,7 +61,7 @@ for(int i=0; i<db->numIcons(); i++){
|
||||
void CSelectIconDlg::OnAddIcon(){
|
||||
QStringList filenames=QFileDialog::getOpenFileNames(this,tr("Add Icons..."),QDir::homePath(),tr("Images (%1)")
|
||||
.arg("*.png *.jpeg *.jpg *.bmp *.gif *.bpm *.pgm *.ppm *.xbm *xpm"));
|
||||
QStringList errors;
|
||||
QString errors;
|
||||
for(int i=0;i<filenames.size();i++){
|
||||
QPixmap icon;
|
||||
if(!icon.load(filenames[i])){
|
||||
@@ -69,8 +70,7 @@ for(int i=0;i<filenames.size();i++){
|
||||
db->addIcon(icon.scaled(16,16,Qt::KeepAspectRatio,Qt::SmoothTransformation));
|
||||
}
|
||||
if(errors.size())
|
||||
QMessageBox::warning(this,tr("Error"),tr("An error occured while loading the icon(s):\n"));
|
||||
ModFlag=true;
|
||||
QMessageBox::warning(this,tr("Error"),tr("An error occured while loading the icon(s):\n%1").arg(errors));
|
||||
updateView();
|
||||
List->setCurrentItem(List->item(List->count()-1));
|
||||
}
|
||||
@@ -80,21 +80,35 @@ void CSelectIconDlg::contextMenuEvent(QContextMenuEvent *event){
|
||||
QListWidgetItem* item=List->itemAt(List->mapFromParent(event->pos()));
|
||||
|
||||
if(!item)return;
|
||||
if(item->data(32).toInt()<BUILTIN_ICONS)
|
||||
if(item->data(32).toInt()<BUILTIN_ICONS){
|
||||
DeleteAction->setDisabled(true);
|
||||
else
|
||||
ReplaceAction->setDisabled(true);}
|
||||
else{
|
||||
DeleteAction->setDisabled(false);
|
||||
ReplaceAction->setDisabled(false);}
|
||||
|
||||
event->accept();
|
||||
CtxMenu->popup(event->globalPos());
|
||||
}
|
||||
|
||||
void CSelectIconDlg::OnDelete(){
|
||||
ModFlag=true;
|
||||
db->removeIcon(List->currentItem()->data(32).toInt());
|
||||
updateView();
|
||||
List->setCurrentItem(List->item(0));
|
||||
}
|
||||
|
||||
void CSelectIconDlg::OnReplace(){
|
||||
QString filename=QFileDialog::getOpenFileName(this,tr("Add Icons..."),QDir::homePath(),tr("Images (%1)")
|
||||
.arg("*.png *.jpeg *.jpg *.bmp *.gif *.bpm *.pgm *.ppm *.xbm *xpm"));
|
||||
if(filename==QString())return;
|
||||
QPixmap icon;
|
||||
if(!icon.load(filename)){
|
||||
QMessageBox::warning(this,tr("Error"),tr("An error occured while loading the icon."));
|
||||
return;
|
||||
}
|
||||
db->replaceIcon(List->currentItem()->data(32).toInt(),icon.scaled(16,16,Qt::KeepAspectRatio,Qt::SmoothTransformation));
|
||||
}
|
||||
|
||||
void CSelectIconDlg::OnPickIcon(){
|
||||
done(List->currentItem()->data(32).toInt());
|
||||
}
|
||||
@@ -107,6 +121,4 @@ done(-1);
|
||||
void CSelectIconDlg::OnSelectionChanged(QListWidgetItem* cur,QListWidgetItem* prev){
|
||||
Button_PickIcon->setEnabled(cur);
|
||||
|
||||
|
||||
|
||||
}
|
||||
@@ -32,13 +32,13 @@ class CSelectIconDlg:public QDialog, public Ui_SelectIconDlg{
|
||||
Q_OBJECT
|
||||
public:
|
||||
CSelectIconDlg(Database* db,int,QWidget* parent = 0, const char* name = 0, bool modal = false, Qt::WFlags fl = 0);
|
||||
bool ModFlag;
|
||||
|
||||
public slots:
|
||||
void OnAddIcon();
|
||||
void OnPickIcon();
|
||||
void OnCancel();
|
||||
void OnDelete();
|
||||
void OnReplace();
|
||||
void OnSelectionChanged(QListWidgetItem*,QListWidgetItem*);
|
||||
|
||||
private:
|
||||
@@ -46,6 +46,7 @@ private:
|
||||
void updateView();
|
||||
QMenu* CtxMenu;
|
||||
QAction* DeleteAction;
|
||||
QAction* ReplaceAction;
|
||||
|
||||
protected:
|
||||
virtual void contextMenuEvent(QContextMenuEvent *event);
|
||||
|
||||
Reference in New Issue
Block a user