author | llornkcor <llornkcor> | 2004-07-14 08:38:10 (UTC) |
---|---|---|
committer | llornkcor <llornkcor> | 2004-07-14 08:38:10 (UTC) |
commit | b09d76574ca6d2ebafca0640ea36c3b785e7f3a3 (patch) (side-by-side diff) | |
tree | 69989e2de473421b1b773cb703b867b04c9e32bd | |
parent | c70dbfde7f9605be295cdc7f789c7e3e8d823d39 (diff) | |
download | opie-b09d76574ca6d2ebafca0640ea36c3b785e7f3a3.zip opie-b09d76574ca6d2ebafca0640ea36c3b785e7f3a3.tar.gz opie-b09d76574ca6d2ebafca0640ea36c3b785e7f3a3.tar.bz2 |
fix opie build
-rw-r--r-- | noncore/apps/zsafe/zsafe.cpp | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/noncore/apps/zsafe/zsafe.cpp b/noncore/apps/zsafe/zsafe.cpp index 41c572a..1c15852 100644 --- a/noncore/apps/zsafe/zsafe.cpp +++ b/noncore/apps/zsafe/zsafe.cpp @@ -614,386 +614,386 @@ ZSafe::ZSafe( QWidget* parent, const char* name, bool modal, WFlags fl ) it->insertItem( edit_img, tr("&Edit"), this, SLOT(editPwd()) ); it->insertItem( trash_img, tr("&Delete"), this, SLOT(deletePwd()) ); it->insertItem( find_img, tr("&Search"), this, SLOT(findPwd()) ); menu->insertItem( tr("&Entry"), it ); QPopupMenu *help = new QPopupMenu( this ); help->insertItem( help_icon_img, tr("&About"), this, SLOT(about()) ); menu->insertItem( tr("&Help"), help ); // toolbar icons New = new QToolButton( menu, "New" ); New->setGeometry( QRect( DeskW-84, 2, 20, 20 ) ); New->setMouseTracking( TRUE ); New->setText( "" ); New->setPixmap( new_img ); QToolTip::add( New, tr( "New entry" ) ); Edit = new QToolButton( menu, "Edit" ); Edit->setGeometry( QRect( DeskW-64, 2, 20, 20 ) ); Edit->setText( "" ); Edit->setPixmap( edit_img ); QToolTip::add( Edit, tr( "Edit category or entry" ) ); Delete = new QToolButton( menu, "Delete" ); Delete->setGeometry( QRect( DeskW-44, 2, 20, 20 ) ); Delete->setText( "" ); Delete->setPixmap( trash_img ); QToolTip::add( Delete, tr( "Delete category or entry" ) ); Find = new QToolButton( menu, "Find" ); Find->setGeometry( QRect( DeskW-24, 2, 20, 20 ) ); Find->setText( "" ); Find->setPixmap( find_img ); QToolTip::add( Find, tr( "Find entry" ) ); /* QBoxLayout * h = new QHBoxLayout( this ); h->addWidget (menu); h->addWidget (New); h->addWidget (Edit); h->addWidget (Delete); h->addWidget (Find); */ ListView = new ZListView( this, "ListView" ); ListView->addColumn( tr( "Name" ) ); ListView->addColumn( tr( "Field 2" ) ); ListView->addColumn( tr( "Field 3" ) ); ListView->addColumn( tr( "Comment" ) ); ListView->addColumn( tr( "Field 4" ) ); ListView->addColumn( tr( "Field 5" ) ); ListView->setAllColumnsShowFocus(TRUE); #ifdef DESKTOP ListView->setResizePolicy(QScrollView::AutoOneFit); // ListView->setGeometry( QRect( 0, 22, this->width(), this->height() - 30 ) ); #else ListView->setResizePolicy(QScrollView::AutoOneFit); // ListView->setGeometry( QRect( 0, 22, // this->width(), this->height() - 30 ) ); // ListView->setMaximumSize( QSize( 440, 290 ) ); #endif ListView->setVScrollBarMode( QListView::Auto ); QBoxLayout * l = new QVBoxLayout( this ); l->addWidget (menu); l->addWidget (ListView); #ifndef DESKTOP // start a timer (100 ms) to load the default document docuTimer.start( 100, true ); connect( &docuTimer, SIGNAL(timeout()), SLOT( slotLoadDocu() ) ); raiseFlag = true; connect( &raiseTimer, SIGNAL(timeout()), SLOT( slotRaiseTimer() ) ); #else // open the default document openDocument(filename); #endif // signals and slots connections for QTollButton connect( New, SIGNAL( clicked() ), this, SLOT( newPwd() ) ); connect( Edit, SIGNAL( clicked() ), this, SLOT( editPwd() ) ); connect( Delete, SIGNAL( clicked() ), this, SLOT( deletePwd() ) ); connect( Find, SIGNAL( clicked() ), this, SLOT( findPwd() ) ); // signals and slots connections for QListView connect( ListView, SIGNAL( selectionChanged(QListViewItem*) ), this, SLOT( listViewSelected(QListViewItem*) ) ); connect( ListView, SIGNAL( doubleClicked(QListViewItem*) ), this, SLOT( showInfo(QListViewItem*) ) ); connect( ListView, SIGNAL( returnPressed(QListViewItem*) ), this, SLOT( showInfo(QListViewItem*) ) ); #ifndef DESKTOP QPEApplication::setStylusOperation( ListView->viewport(),QPEApplication::RightOnHold); #endif connect( ListView, SIGNAL( mouseButtonPressed( int, QListViewItem *, const QPoint&, int)), this,SLOT( ListPressed(int, QListViewItem *, const QPoint&, int)) ); this->setIcon( image0); } const QColor *ZSafe::evenRowColor = &Qt::white; // const QColor *ZSafe::oddRowColor = &Qt::lightGray; const QColor *ZSafe::oddRowColor = new QColor(216,240,255); /* * Destroys the object and frees any allocated resources */ ZSafe::~ZSafe() { // no need to delete child widgets, Qt does it all for us quitMe(); } // load the default document void ZSafe::slotLoadDocu() { openDocument (filename); } void ZSafe::deletePwd() { if (!selectedItem) return; if (!isCategory(selectedItem)) { switch( QMessageBox::information( this, tr("ZSafe"), tr("Do you want to delete?"), tr("&Delete"), tr("D&on't Delete"), 0 // Enter == button 0 ) ) { // Escape == button 2 case 0: // Delete clicked, Alt-S or Enter pressed. // Delete modified = true; selectedItem->parent()->takeItem(selectedItem); selectedItem = NULL; break; case 1: // Don't delete break; } } else { delCategory(); } } void ZSafe::editPwd() { if (!selectedItem) return; if (!isCategory(selectedItem)) { // open the 'New Entry' dialog NewDialog *dialog = new NewDialog(this, "edit_entry", TRUE); #ifdef Q_WS_WIN dialog->setCaption ("Qt " + tr("Edit Entry")); dialog->setGeometry(200, 250, 220, 310 ); #endif // set the labels dialog->Name->setText(getFieldLabel (selectedItem, "1", tr("Name"))); dialog->Username->setText(getFieldLabel (selectedItem, "2", tr("Username"))); dialog->Password->setText(getFieldLabel (selectedItem, "3", tr("Password"))); dialog->Comment->setText(getFieldLabel (selectedItem, "4", tr("Comment"))); dialog->Field5Label->setText(getFieldLabel (selectedItem,"5", tr("Field 4"))); dialog->Field6Label->setText(getFieldLabel (selectedItem,"6", tr("Field 5"))); // set the fields dialog->NameField->setText(selectedItem->text (0)); dialog->UsernameField->setText(selectedItem->text (1)); dialog->PasswordField->setText(selectedItem->text (2)); QString comment = selectedItem->text (3); comment.replace (QRegExp("<br>"), "\n"); dialog->Field5->setText(selectedItem->text (4)); dialog->Field6->setText(selectedItem->text (5)); dialog->CommentField->insertLine(comment); dialog->CommentField->setCursorPosition(0,0); #ifdef Q_WS_QWS DialogCode result = (DialogCode) QPEApplication::execDialog( dialog ); #endif #ifdef DESKTOP #ifndef Q_QW_QWIN dialog->show(); #endif #else dialog->showMaximized(); #endif - int result = dialog->exec(); #ifdef DESKTOP + int result = dialog->exec(); // result = QDialog::Accepted; #endif if (result == Accepted) { modified = true; // edit the selected item QString name = dialog->NameField->text(); selectedItem->setText (0, tr (name)); QString user = dialog->UsernameField->text(); selectedItem->setText (1, tr (user)); QString pwd = dialog->PasswordField->text(); selectedItem->setText (2, tr (pwd)); QString comment = dialog->CommentField->text(); comment.replace (QRegExp("\n"), "<br>"); selectedItem->setText (3, tr (comment)); QString f5 = dialog->Field5->text(); selectedItem->setText (4, tr (f5)); QString f6 = dialog->Field6->text(); selectedItem->setText (5, tr (f6)); } delete dialog; } else { editCategory(); } } void ZSafe::newPwd() { if (!selectedItem) return; if (!isCategory(selectedItem)) selectedItem = selectedItem->parent(); if (isCategory(selectedItem)) { QString cat = selectedItem->text(0); // open the 'New Entry' dialog NewDialog *dialog = new NewDialog(this, "new_entry", TRUE); #ifdef Q_WS_WIN dialog->setCaption ("Qt " + tr("New Entry")); dialog->setGeometry(200, 250, 220, 310 ); #endif // set the labels dialog->Name->setText(getFieldLabel (selectedItem, "1", tr("Name"))); dialog->Username->setText(getFieldLabel (selectedItem, "2", tr("Username"))); dialog->Password->setText(getFieldLabel (selectedItem, "3", tr("Password"))); dialog->Comment->setText(getFieldLabel (selectedItem, "4", tr("Comment"))); dialog->Field5Label->setText(getFieldLabel (selectedItem,"5", tr("Field 4"))); dialog->Field6Label->setText(getFieldLabel (selectedItem,"6", tr("Field 5"))); retype: #ifdef Q_WS_QWS DialogCode result = (DialogCode) QPEApplication::execDialog( dialog ); #endif #ifdef DESKTOP #ifndef Q_QW_QWIN dialog->show(); #endif #else dialog->showMaximized(); #endif #ifdef DESKTOP int result = dialog->exec(); // result = QDialog::Accepted; #endif if (result == Accepted) { QString name = dialog->NameField->text(); if (cat == name) { QMessageBox::critical( 0, tr("ZSafe"), tr("Entry name must be different\nfrom the category name.") ); goto retype; // it's not a good programming style :-) } modified = true; // add the new item QListViewItem *i = new ShadedListItem (0, selectedItem); i->setOpen (TRUE); i->setText (0, tr (name)); QString user = dialog->UsernameField->text(); i->setText (1, tr (user)); QString pwd = dialog->PasswordField->text(); i->setText (2, tr (pwd)); QString comment = dialog->CommentField->text(); comment.replace (QRegExp("\n"), "<br>"); i->setText (3, tr (comment)); QString f5 = dialog->Field5->text(); i->setText (4, tr (f5)); QString f6 = dialog->Field6->text(); i->setText (5, tr (f6)); } delete dialog; } } void ZSafe::findPwd() { // open the 'Search' dialog SearchDialog *dialog = new SearchDialog(this, tr("Search"), TRUE); #ifdef Q_WS_WIN dialog->setCaption ("Qt " + tr("Search")); #endif #ifdef DESKTOP #endif if (lastSearchedName) dialog->NameField->setText(lastSearchedName); else dialog->NameField->setText(""); if (lastSearchedUsername) dialog->UsernameField->setText(lastSearchedUsername); else dialog->UsernameField->setText(""); if (lastSearchedComment) dialog->CommentField->setText(lastSearchedComment); else dialog->CommentField->setText(""); DialogCode result = (DialogCode) dialog->exec(); #ifdef DESKTOP result = Accepted; #endif QString name; QString username; QString comment; if (result == Accepted) { name = dialog->NameField->text(); username = dialog->UsernameField->text(); comment = dialog->CommentField->text(); #ifndef NO_OPIE owarn << name << oendl; #else qWarning (name); #endif } else { delete dialog; return; } if (!name.isEmpty() && name != lastSearchedName || lastSearchedName.isEmpty() && !name.isEmpty()) { // set search at the beginning if a new name is given lastSearchedCategory = NULL; lastSearchedItem = NULL; } lastSearchedName = name; if (!username.isEmpty() && username != lastSearchedUsername || lastSearchedUsername.isEmpty() && !username.isEmpty()) { // set search at the beginning if a new name is given lastSearchedCategory = NULL; lastSearchedItem = NULL; } lastSearchedUsername = username; if (!comment.isEmpty() && comment != lastSearchedComment || lastSearchedComment.isEmpty() && !comment.isEmpty()) { // set search at the beginning if a new name is given lastSearchedCategory = NULL; lastSearchedItem = NULL; } lastSearchedComment = comment; ListView->clearSelection(); bool found=FALSE; // step through all categories QListViewItem *i; if (lastSearchedCategory) i = lastSearchedCategory; else i = ListView->firstChild(); for (; i != NULL; i = i->nextSibling()) { |