summaryrefslogtreecommitdiffabout
Side-by-side diff
Diffstat (more/less context) (show whitespace changes)
-rw-r--r--bin/kdepim/pwmanager/germantranslation.txt2
-rw-r--r--kaddressbook/jumpbuttonbar.cpp1
-rw-r--r--microkde/kutils/kcmultidialog.cpp6
-rw-r--r--pwmanager/pwmanager/editcategory.cpp1
4 files changed, 7 insertions, 3 deletions
diff --git a/bin/kdepim/pwmanager/germantranslation.txt b/bin/kdepim/pwmanager/germantranslation.txt
index 5941c2a..a47b123 100644
--- a/bin/kdepim/pwmanager/germantranslation.txt
+++ b/bin/kdepim/pwmanager/germantranslation.txt
@@ -170,184 +170,184 @@
{ "Message:","Message:" },
{ "Parameters:","Parameter:" },
{ "HINT: Delimiter=; Name=%1,Email=%2","Hinweis: Begrenzer=; Name=%1,Email=%2" },
{ "extra Message:","extra Message:" },
{ "extra Parameters:","extra Parameter:" },
{ "HINT: Emails=%1,Attachments=%2","Hinweis: Emails=%1,Attachments=%2" },
{ "External Apps.","Externe Appl." },
{ "Your current storage dir is:\n%1\nYour mail is stored in:\n(storagedir)/apps/kopiemail/localmail","Ihr gerade genutztes Speicherverzeichnis ist:\n%1\nIhre Mail wird gespeichert in:\n(speicherverzeichnis)/apps/kopiemail/localmail" },
{ "<b>Set new data storage dir:</b>","<b>Setze neues Datenspeicherverzeichnis:</b>" },
{ "Not existing dirs are created automatically","Nicht existierende Verzeichnisse werden erstellt" },
{ "Save settings","Speichere Einstellungen" },
{ "Save standard","Speichere Standard" },
{ "<b>New settings are used\nafter a restart</b>","<b>Neue Einstellungen werden nach\neinem Neustart genutzt</b>" },
{ "The settings of the storage\ndir is saved in the file\n%1","Die Einstellungen des Speicherverzeichnisses\nwerden in folgender Datei gespeichert:\n%1" },
{ "Data storage path","Daten Speicherpfad" },
{ "Used %1 Client","Benutzer %1 Client" },
{ "No email client installed","Keine Email Client installiert" },
{ "Userdefined email client","Benutzerdef. Email Client" },
{ "OM/Pi email client","OM/Pi Email Client" },
{ "URL:","URL:" },
{ "No","Nein" },
{ "Yes","Ja" },
{ "Untitled","Unbenannt" },
{ "&New","&Neu" },
{ "&Open","&Öffne" },
{ "&Close","Schließen" },
{ "Save &as...","Speichere &als..." },
{ "&Text-file...","&Text-Datei..." },
{ "&Gpasman / Kpasman ...","&Gpasman / Kpasman ..." },
{ "&CSV (Comma Separated Value) ...","&CSV (Komma getrennte Werte) ..." },
{ "E&xport","E&xport" },
{ "I&mport","I&mport" },
{ "&Quit","Beenden" },
{ "&Add password","&Passwort hinzufügen" },
{ "&Delete","Lösche" },
{ "Change &Master Password","Ändere &Master Passwort" },
{ "&Manage","Verwalte" },
{ "&Find","&Finde" },
{ "&Lock all entries","Sperre alle Einträge" },
{ "&Deep-lock all entries","Sperre total alle Einträge" },
{ "&Unlock all entries","Entsperre alle Einträge" },
{ "&Configure...","Konfiguriere..." },
{ "&Options","&Optionen" },
{ "C&ategories...","K&ategorien..." },
{ "&Sync","&Sync" },
{ "&License","&Lizenz" },
{ "&Faq","&Faq" },
{ "&About PwManager","Über PwManager" },
{ "&Sync HowTo","&Sync HowTo" },
{ "&What's New","Was ist neu?" },
{ "New","Neu" },
{ "Open","Öffnen" },
{ "Save","Speichern" },
{ "Save as","Speichern als" },
{ "Print...","Drucke..." },
{ "Add password","Passwort hinzufügen" },
{ "Edit password","Passwort ändern" },
{ "Delete password","Passwort löschen" },
{ "Find entry","Finde Eintrag" },
{ "Lock all entries","Sperre alle Einträge" },
{ "Deep-Lock all entries","Sperre total alle Einträge" },
{ "Unlock all entries","Entsperre alle Einträge" },
{ "Categories:","Kategorien:" },
{ "&Rename","&Umbenennen" },
{ "Username","Benutzername" },
{ "Password","Passwort" },
{ "Launcher","Launcher" },
{ "copy password to clipboard","Kopiere Passwort ins Clipboard" },
{ "copy username to clipboard","Kopiere Benutzername ins Clipboard" },
{ "copy description to clipboard","Kopiere Beschreibung ins Clipboard" },
{ "copy url to clipboard","Kopiere URL ins Clipboard" },
{ "copy launcher to clipboard","Kopiere Launcher ins Clipboard" },
{ "copy comment to clipboard","Kopiere Kommentare ins Clipboard" },
{ "Execute "Launcher"",""Launcher" ausführen" },
{ "Go to "URL"","Gehe zu "URL"" },
{ "Ready.","Fertig." },
{ "password filename(*.pwm)","passwort dateiname(*.pwm)" },
{ "File error","Datei Fehler" },
{ "Could not read file!","Kann Datei nicht lesen!" },
{ "Master-password","Master-Passwort" },
{ "Please enter the master-password:","Bitter Master-Passwort eingeben:" },
{ "Wrong master-password!\nPlease try again.","Falsches Master-Passwort!\nBitte erneut versuchen." },
{ "password error","Passwort Fehler" },
{ "Successfully opened file.","Datei erfolgreich geöffnet." },
{ "DEEP-LOCKED","DEEP-LOCKED" },
{ "This file is DEEP-LOCKED!\nThat means all data has been encrypted\nand written out to the file. If you want\nto see the entries, please UNLOCK the file.\nWhile unlocking, you will be prompted for the\nmaster-password or the key-card.","This file is DEEP-LOCKED!\nThat means all data has been encrypted\nand written out to the file. If you want\nto see the entries, please UNLOCK the file.\nWhile unlocking, you will be prompted for the\nmaster-password or the key-card." },
{ "<LOCKED>","<GESPERRT>" },
{ "To unlock click the icon on the left.","Zum Entsperren klicke auf das linke Icon." },
{ "PwManager","PwManager" },
{ "Window-style:","Window-style:" },
{ "Category on top","Kategorien oben" },
{ "Category-list left/top","Kategorien links oben" },
{ "<b>Font for Password entries:</b>","<b>Schrift für Passwort Einträge:</b>" },
{ "Font:","Schriftart:" },
{ "Compression:","Kompression:" },
{ "gzip","gzip" },
{ "Encryption:","Verschlüsselung:" },
{ "Blowfish (128 bit)","Blowfish (128 bit)" },
{ "AES-128, Rijndael (128 bit)","AES-128, Rijndael (128 bit)" },
{ "AES-192, Rijndael (192 bit)","AES-192, Rijndael (192 bit)" },
{ "AES-256, Rijndael (256 bit)","AES-256, Rijndael (256 bit)" },
{ "Triple-DES (168 bit)","Triple-DES (168 bit)" },
{ "Twofish (256 bit)","Twofish (256 bit)" },
{ "Twofish-128 (128 bit)","Twofish-128 (128 bit)" },
{ "Hashing:","Hashing:" },
{ "SHA-160, SHA1 (160 bit)","SHA-160, SHA1 (160 bit)" },
{ "SHA-256 (256 bit)","SHA-256 (256 bit)" },
{ "SHA-384 (384 bit)","SHA-384 (384 bit)" },
{ "SHA-512 (512 bit)","SHA-512 (512 bit)" },
{ "MD5 (128 bit)","MD5 (128 bit)" },
{ "RIPE-MD-160 (160 bit)","RIPE-MD-160 (160 bit)" },
{ "Tiger (192 bit)","Tiger (192 bit)" },
{ "Permissions:","Zugriffsrechte:" },
{ "Make backup before saving","Mache Backup vor dem Speichern" },
{ "Password timeout\n(timeout to hold password in\nmemory,so you don't have to\nre-enter it,if you\nalready have entered it)\n[set to 0 to disable]:","Passwort Timeout\n(Timeout um das Passwort\nim Speicher zu halten,\nso dass es nicht noch mal\neingegeben werden muß.)\n[Setze auf 0 zum deaktivieren]:" },
{ "Auto-lock timeout\n(auto lock document after this\namount of seconds)\n[set to 0 to disable]:","(Total-)Sperr-Timeout\n(Sperre Dokument total nach\ndieser Anzahl Sekunden)\n[Setze auf 0 zum deaktivieren]:" },
{ "deep-lock on autolock","Sperre total beim Sperr-Timeout" },
{ "open deeplocked","Öffne total gesperrt" },
{ "Favourite browser:","Bevorzugter Browser:" },
{ "Favourite x-terminal:","Bevorzugtes x-terminal:" },
{ "Open document with passwords unlocked","Öffne Dokument mit Passwort ungesperrt" },
{ "Look && feel","Aussehen" },
{ "File","Datei" },
{ "Timeout","Timeout" },
{ "Autostart","Autostart" },
{ "External apps","Externe Applik." },
{ "Miscellaneous","Verschiedenes" },
{ "+01:00 Europe/Oslo(CET)","+01:00 Europe/Oslo(CET)" },
-{ "edit category descriptions","Ändrere Kategoriebeschreibungen" },
+{ "edit category descriptions","Ändere Label für Kategorie" },
{ "Close","Schließen" },
{ "Category:","Category:" },
{ "Text1 (Description):","Text1 (Beschreibung):" },
{ "Text2 (Username):","Text2 (Benutzername):" },
{ "Text3 (Password):","Text3 (Passwort):" },
{ "edit/add a password entry","Ändere/hinzufüge Passwort Eintrag" },
{ "Description:","Beschreibung:" },
{ "Username:","Benutzername:" },
{ "Password:","Passwort:" },
{ "&Reveal","&Offen zeigen" },
{ "&Generate","&Generiere" },
{ "&Password","&Passwort" },
{ "&Comments","Kommentare" },
{ "Launcher:","Launcher:" },
{ "$d = Description","$d = Beschreibung" },
{ "$n = Username","$n = Benutzername" },
{ "$c = Comment","$c = Kommentar" },
{ "$u = URL","$u = URL" },
{ "$p = Password","$p = Passwort" },
{ "&Launcher","&Launcher" },
{ "Password generator","Passwort Generator" },
{ "Character set:","Buchstaben Set:" },
{ "Lowercase (abc)","Klein (abc)" },
{ "Uppercase (ABC)","Groß (ABC)" },
{ "Numbers (123)","Nummmern (123)" },
{ "Special characters:","Spezielle Buchstaben:" },
{ "Spaces (blank characters)","Leerzeichen" },
{ "User defined:","Benutzer definiert:" },
{ "Password Length:","Passwort Länge:" },
{ "Enable Filtering to get better passwords","Enable Filtering to get better passwords" },
{ "no password","Kein Passwort" },
{ "Sorry, you haven't set a password.","Sorry, Sie haben kein Passwort angegeben." },
{ "not saved, yet","not saved, yet" },
{ "Can't deep-lock, because the document\nhasn't been saved, yet. Please save\nto a file and try again.","Kann nicht tiefsperren, weil das\nDokument noch nicht gespeichert wurde.\nBitte speichern und noch einmal versuchen." },
{ "Find","Finde" },
{ "&Exact match","Genaue Übereinstimmung" },
{ "&Case sensitive","Großschrift abhängig" },
{ "Search in Column","Suche in Spalten" },
{ "&Description","Beschreibung" },
{ "C&omment","Kommentar" },
{ "&Username","Benutzername" },
{ "U&RL","URL" },
{ "delete?","Löschen?" },
{ "Do you really want to delete\nthe selected entry","Wollen Sie wirklich\nden Eintrag löschen:" },
{ "Save?","Speichern?" },
{ ""\nhas been modified.\nDo you want to save it?",""\nwurde geändert.\nMöchten Sie speichern?" },
{ "The list\n "","Die Liste\n "" },
{ "nothing to do","Nichts zu tun" },
{ "Sorry, there's nothing to save.\nPlease first add some passwords.","Sorry, es gibt nichts zu speichern.\nBitte erst Passwörter hinzufügen." },
{ "","" },
{ "","" },
{ "","" },
{ "","" },
{ "","" },
diff --git a/kaddressbook/jumpbuttonbar.cpp b/kaddressbook/jumpbuttonbar.cpp
index ee5b44e..184d516 100644
--- a/kaddressbook/jumpbuttonbar.cpp
+++ b/kaddressbook/jumpbuttonbar.cpp
@@ -1,232 +1,233 @@
/*
This file is part of KAddressBook.
Copyright (c) 2002 Mike Pilone <mpilone@slac.com>
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
As a special exception, permission is given to link this program
with any edition of Qt, and distribute the resulting executable,
without including the source code for Qt in the source distribution.
*/
#include <qevent.h>
#include <qlayout.h>
#include <qpushbutton.h>
#include <qstring.h>
#include <qtl.h>
#include <qapplication.h>
#include <kabc/addressbook.h>
#include <kabc/field.h>
#include <kdebug.h>
#include <klocale.h>
#include "kabcore.h"
#include "jumpbuttonbar.h"
class JumpButton : public QPushButton
{
public:
JumpButton( const QString &text, QWidget *parent,
const QString &character );
void setCharacter( const QString &character );
QString character() const;
private:
QString mCharacter;
};
JumpButton::JumpButton( const QString &text, QWidget *parent,
const QString &character )
: QPushButton( text, parent )
{
mCharacter = character;
}
void JumpButton::setCharacter( const QString &character )
{
mCharacter = character;
setText(mCharacter.upper() );
}
QString JumpButton::character() const
{
return mCharacter;
}
JumpButtonBar::JumpButtonBar( KABCore *core, QWidget *parent, const char *name )
: QWidget( parent, name ), mCore( core )
{
if ( QApplication::desktop()->width() < 480 )
mButtonLayout = new QGridLayout( this, 2, 14 );
else
mButtonLayout = new QGridLayout( this, 1, 28 );
mButtonLayout->setAlignment( Qt::AlignTop );
recreateButtons();
}
JumpButtonBar::~JumpButtonBar()
{
}
QSizePolicy JumpButtonBar::sizePolicy() const
{
#ifndef KAB_EMBEDDED
return QSizePolicy( QSizePolicy::Maximum, QSizePolicy::Minimum,
QSizePolicy::Vertically );
#else //KAB_EMBEDDED
return QSizePolicy( QSizePolicy::Maximum, QSizePolicy::Minimum);
#endif //KAB_EMBEDDED
}
void JumpButtonBar::letterClicked()
{
JumpButton *button = (JumpButton*)sender();
QString character = button->character();
if ( !character.isNull() )
emit jumpToLetter( character );
}
void JumpButtonBar::recreateButtons()
{
// the easiest way to remove all buttons ;)
//mButtons.setAutoDelete( true );
//mButtons.clear();
//mButtons.setAutoDelete( false );
mCharacters.clear();
QString character;
KABC::AddressBook *ab = mCore->addressBook();
KABC::AddressBook::Iterator it;
KABC::Field *field = mCore->currentSearchField();
if ( field ) {
setEnabled( true );
} else {
setEnabled( false );
return;
}
for ( it = ab->begin(); it != ab->end(); ++it ) {
if ( !field->value( *it ).isEmpty() )
character = field->value( *it )[ 0 ].lower();
+ if ( character != "!" )
if ( !character.isEmpty() && !mCharacters.contains( character ) )
mCharacters.append( character );
}
if ( mCharacters.count() == 0 ) {
setEnabled( false );
return;
}
int maxRows = mCharacters.count() / 2; // we use 2 columns
if ( mCharacters.count() % 2 )
maxRows++;
int fixwid = 20;
sortListLocaleAware( mCharacters );
bool skip2 = false;
int skipcount = 0;
int maxHei = 25;
if ( QApplication::desktop()->width() < 480 && mCharacters.count() > 13) {
skipcount = mCharacters.count()-13;
maxHei = (QApplication::desktop()->height()-65)/13;
}
else {
fixwid = 30;
if ( mCharacters.count() > 20 )
skipcount = mCharacters.count()- 20;
maxHei = (QApplication::desktop()->height()-120)/(mCharacters.count()-skipcount);
}
maxRows = 28;
bool skipcurrent = false;
bool state = isUpdatesEnabled();
setUpdatesEnabled( false );
//qDebug("cc %d ",mCharacters.count() );
JumpButton *button;
int row = 0, col = 0;
JumpButton* cur = mButtons.first();
for ( uint i = 0; i < mCharacters.count(); ++i ) {
if ( skipcount > 0 && skipcurrent ) {
--skipcount;
} else {
if ( cur ) {
button = cur ;
cur = mButtons.next();
button->setCharacter(mCharacters[ i ]);
} else {
button = new JumpButton( mCharacters[ i ].upper(), this, mCharacters[ i ] );
button->setFixedWidth( fixwid );
mButtons.append( button );
connect( button, SIGNAL( clicked() ), this, SLOT( letterClicked() ) );
mButtonLayout->addWidget( button, row, col );
}
button->setMaximumHeight( maxHei );
button->show();
if ( col == maxRows ) {
row = 0;
col++;
} else
row++;
}
skipcurrent = !skipcurrent;
}
while ( cur ) {
cur->hide();
cur = mButtons.next();
}
mButtonLayout->activate();
setUpdatesEnabled( state );
update();
}
void JumpButtonBar::sortListLocaleAware( QStringList &list )
{
QStringList::Iterator beginIt = list.begin();
QStringList::Iterator endIt = list.end();
--endIt;
if ( beginIt == endIt ) // don't need sorting
return;
QStringList::Iterator walkBackIt = endIt;
while ( beginIt != endIt ) {
QStringList::Iterator j1 = list.begin();
QStringList::Iterator j2 = j1;
++j2;
while ( j1 != walkBackIt ) {
#ifndef KAB_EMBEDDED
if ( QString::localeAwareCompare( *j2, *j1 ) < 0 )
#else //KAB_EMBEDDED
if ( QString::compare( *j2, *j1 ) < 0 )
#endif //KAB_EMBEDDED
qSwap( *j1, *j2 );
++j1;
++j2;
}
++beginIt;
--walkBackIt;
}
}
#ifndef KAB_EMBEDDED
#include "jumpbuttonbar.moc"
#endif //KAB_EMBEDDED
diff --git a/microkde/kutils/kcmultidialog.cpp b/microkde/kutils/kcmultidialog.cpp
index 248476f..4daa4ff 100644
--- a/microkde/kutils/kcmultidialog.cpp
+++ b/microkde/kutils/kcmultidialog.cpp
@@ -1,184 +1,186 @@
/*
Copyright (c) 2000 Matthias Elter <elter@kde.org>
Copyright (c) 2003 Daniel Molkentin <molkentin@kde.org>
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Library General Public
License as published by the Free Software Foundation; either
version 2 of the License, or (at your option) any later version.
This library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Library General Public License for more details.
You should have received a copy of the GNU Library General Public License
along with this library; see the file COPYING.LIB. If not, write to
the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
Boston, MA 02111-1307, USA.
*/
#include <qhbox.h>
#include <qvbox.h>
#include <qcursor.h>
#include <qlayout.h>
#include <klocale.h>
#include <kglobal.h>
#include <kdebug.h>
#include <kiconloader.h>
#include <kmessagebox.h>
//US #include <klibloader.h>
#include <krun.h>
#include <kprocess.h>
#include "kcmultidialog.h"
//US #include "kcmultidialog.moc"
//US #include "kcmoduleloader.h"
KCMultiDialog::KCMultiDialog(const QString& baseGroup, QWidget *parent, const char *name, bool modal)
: KDialogBase(IconList, i18n("Configure"), Default |Cancel | Apply | Ok, Ok,
parent, name, modal, true), d(0L)
{
enableButton(Apply, false);
//connect(this, SIGNAL(aboutToShowPage(QWidget *)), this, SLOT(slotAboutToShow(QWidget *)));
connect( this, SIGNAL( defaultClicked() ), SLOT( slotDefault() ) );
_baseGroup = baseGroup;
mMainWidget = new KJanusWidget( this, "JanusWidget", KJanusWidget::Tabbed );
setMainWidget(mMainWidget );
#ifdef DESKTOP_VERSION
resize(640,480);
#else
- resize(640,480);
- setMaximumSize( KMIN(KGlobal::getDesktopWidth()-5, 640), KMIN(KGlobal::getDesktopHeight()-20, 480));
+ //resize(640,480);
+ //setMaximumSize( KMIN(KGlobal::getDesktopWidth()-5, 640), KMIN(KGlobal::getDesktopHeight()-20, 480));
+ resize(800,800);
+ setMaximumSize( 800, 800 );
//showMaximized();
#endif
}
KCMultiDialog::~KCMultiDialog()
{
//US moduleDict.setAutoDelete(true);
}
void KCMultiDialog::slotDefault()
{
int curPageIndex = activePageIndex();
QPtrListIterator<KCModule> it(modules);
for (; it.current(); ++it)
{
if (pageIndex((QWidget *)(*it)->parent()) == curPageIndex)
{
(*it)->defaults();
clientChanged(true);
return;
}
}
}
void KCMultiDialog::accept()
{
slotOk();
}
void KCMultiDialog::slotApply()
{
QPtrListIterator<KCModule> it(modules);
for (; it.current(); ++it)
(*it)->save();
clientChanged(false);
emit applyClicked();
}
void KCMultiDialog::slotOk()
{
qDebug("KCMultiDialog::slotOk clicked");
QPtrListIterator<KCModule> it(modules);
for (; it.current(); ++it)
(*it)->save();
QDialog::accept();
emit okClicked();
}
void KCMultiDialog::slotHelp()
{
/*US
KURL url( KURL("help:/"), _docPath );
if (url.protocol() == "help" || url.protocol() == "man" || url.protocol() == "info") {
KProcess process;
process << "khelpcenter"
<< url.url();
process.start(KProcess::DontCare);
process.detach();
} else {
new KRun(url);
}
*/
}
void KCMultiDialog::clientChanged(bool state)
{
enableButton(Apply, state);
}
/*US
void KCMultiDialog::addModule(const QString& path, bool withfallback)
{
kdDebug(1208) << "KCMultiDialog::addModule " << path << endl;
KCModuleInfo info(path, _baseGroup);
QHBox* page = addHBoxPage(info.moduleName(), info.comment(),
KGlobal::iconLoader()->loadIcon(info.icon(), KIcon::Desktop, KIcon::SizeMedium));
if(!page) {
KCModuleLoader::unloadModule(info);
return;
}
moduleDict.insert(page, new LoadInfo(path, withfallback));
if (modules.isEmpty())
slotAboutToShow(page);
}
*/
QVBox * KCMultiDialog::getNewVBoxPage( const QString & modulename )
{
QVBox *page = mMainWidget->addVBoxPage(modulename , QString::null,QPixmap() );
return page;
}
//US special method for microkde. We dop noty want to load everything dynamically.
void KCMultiDialog::addModule(KCModule* module ) //, const QString& modulename, const QString& iconname)
{
modules.append(module);
connect(module, SIGNAL(changed(bool)), this, SLOT(clientChanged(bool)));
//US
module->load();
}
void KCMultiDialog::slotAboutToShow(QWidget *page)
{
/*US
LoadInfo *loadInfo = moduleDict[page];
if (!loadInfo)
return;
QApplication::setOverrideCursor(Qt::WaitCursor);
moduleDict.remove(page);
KCModuleInfo info(loadInfo->path, _baseGroup);
KCModule *module = KCModuleLoader::loadModule(info, loadInfo->withfallback);
diff --git a/pwmanager/pwmanager/editcategory.cpp b/pwmanager/pwmanager/editcategory.cpp
index 4e55de8..4e2378c 100644
--- a/pwmanager/pwmanager/editcategory.cpp
+++ b/pwmanager/pwmanager/editcategory.cpp
@@ -20,169 +20,170 @@
with any edition of Qt, and distribute the resulting executable,
without including the source code for Qt in the source distribution.
$Id$
*/
#include "editcategory.h"
#include "pwmdoc.h"
#include <qlayout.h>
#include <qlabel.h>
#include <qgroupbox.h>
#include <klocale.h>
#include <kcombobox.h>
#include <klineedit.h>
#include <qpushbutton.h>
/*
* Constructs a addEntryWnd as a child of 'parent', with the
* name 'name' and widget flags set to 'f'.
*
* The dialog will by default be modeless, unless you set 'modal' to
* TRUE to construct a modal dialog.
*/
editCategoryWnd::editCategoryWnd( PwMDoc* d, QWidget* parent, const char* name)
: KDialogBase( KDialogBase::Plain, i18n( "edit category descriptions" ),
Apply | User2 | Ok,
Ok, parent, name, true ),
doc(d)
{
findButton( Ok )->setText (i18n("Close" )) ;
findButton( User2 )->setText (i18n("Cancel" )) ;
connect(this,SIGNAL(user2Clicked()), SLOT(cancel_slot()));
enableButton( KDialogBase::Apply, false );
QWidget *page = plainPage();
QGridLayout *layout = new QGridLayout( page, 3, 1 );
layout->setMargin( KDialogBase::marginHint() );
layout->setSpacing( KDialogBase::spacingHint() );
int i = 0;
categoryComboBox = new KComboBox( page );
QLabel* label = new QLabel( categoryComboBox, i18n("Category:"), page );
layout->addWidget( label, i, 0 );
layout->addWidget( categoryComboBox, i, 1 );
i++;
categoryComboBox->setEditable( FALSE );
categoryComboBox->setSizeLimit( 100 );
connect(categoryComboBox,SIGNAL(activated(const QString&)), SLOT(categorySelected(const QString&)));
descLineEdit = new KLineEdit( page, "descLineEdit" );
label = new QLabel( descLineEdit, i18n("Text1 (Description):"), page );
layout->addWidget( label, i, 0 );
layout->addWidget( descLineEdit, i, 1 );
connect( descLineEdit, SIGNAL( textChanged ( const QString & ) ), SLOT( widgetModified(const QString &) ) );
i++;
usernameLineEdit = new KLineEdit( page, "usernameLineEdit" );
label = new QLabel( usernameLineEdit, i18n("Text2 (Username):"), page );
layout->addWidget( label, i, 0 );
layout->addWidget( usernameLineEdit, i, 1 );
connect( usernameLineEdit, SIGNAL( textChanged ( const QString & ) ), SLOT( widgetModified(const QString &) ) );
i++;
pwLineEdit = new KLineEdit( page, "pwLineEdit" );
label = new QLabel( pwLineEdit, i18n("Text3 (Password):"), page );
layout->addWidget( label, i, 0 );
layout->addWidget( pwLineEdit, i, 1 );
connect( pwLineEdit, SIGNAL( textChanged ( const QString & ) ), SLOT( widgetModified(const QString &) ) );
i++;
unsigned int count = doc->numCategories();
for (unsigned int i = 0; i < count; ++i) {
categoryComboBox->insertItem(doc->getCategory(i)->c_str());
}
// PwMCategoryItem* getCategoryEntry(unsigned int index)
// { return &(dti.dta[index]); }
}
/*
* Destroys the object and frees any allocated resources
*/
editCategoryWnd::~editCategoryWnd()
{
// no need to delete child widgets, Qt does it all for us
}
void editCategoryWnd::slotOk()
{
// qDebug( "addEntryWnd::slotOk(): Not implemented yet" );
slotApply();
accept();
}
void editCategoryWnd::slotApply()
{
QString cat = categoryComboBox->currentText();
unsigned int idx;
bool found = doc->findCategory(cat, &idx);
if (found == true)
{
PwMCategoryItem* catitem = doc->getCategoryEntry(idx);
catitem->desc_text = descLineEdit->text().latin1();
catitem->name_text = usernameLineEdit->text().latin1();
catitem->pw_text = pwLineEdit->text().latin1();
enableButton( KDialogBase::Apply, false );
return;
}
BUG();
}
void editCategoryWnd::cancel_slot()
{
QString cat = categoryComboBox->currentText();
categorySelected ( cat );
+ reject();
}
void editCategoryWnd::setCurrCategory(const QString &cat)
{
int i, count = categoryComboBox->count();
for (i = 0; i < count; ++i) {
if (categoryComboBox->text(i) == cat) {
categoryComboBox->setCurrentItem(i);
categorySelected ( cat );
return;
}
}
BUG();
}
void editCategoryWnd::categorySelected ( const QString & string )
{
unsigned int idx;
bool found = doc->findCategory(string, &idx);
if (found == true)
{
PwMCategoryItem* catitem = doc->getCategoryEntry(idx);
descLineEdit->setText(catitem->desc_text.c_str());
usernameLineEdit->setText(catitem->name_text.c_str());
pwLineEdit->setText(catitem->pw_text.c_str());
enableButton( KDialogBase::Apply, false );
return;
}
BUG();
}
void editCategoryWnd::widgetModified(const QString &)
{
enableButton( KDialogBase::Apply, true );
}