author | zautrix <zautrix> | 2005-01-21 19:36:09 (UTC) |
---|---|---|
committer | zautrix <zautrix> | 2005-01-21 19:36:09 (UTC) |
commit | 243562861a82aa2793362029a6c93b2b300b9477 (patch) (side-by-side diff) | |
tree | 2ec9c81f21ef058dedf506d1d0be7213b9301eef | |
parent | 5cbac3131e5cecde6042db12ca73d5cd72fbed77 (diff) | |
download | kdepimpi-243562861a82aa2793362029a6c93b2b300b9477.zip kdepimpi-243562861a82aa2793362029a6c93b2b300b9477.tar.gz kdepimpi-243562861a82aa2793362029a6c93b2b300b9477.tar.bz2 |
added tr.h
-rw-r--r-- | kabc/distributionlisteditor.cpp | 4 | ||||
-rw-r--r-- | kaddressbook/tr.h | 2 | ||||
-rw-r--r-- | korganizer/tr.h | 2 |
3 files changed, 8 insertions, 0 deletions
diff --git a/kabc/distributionlisteditor.cpp b/kabc/distributionlisteditor.cpp index bad1efc..9f5840b 100644 --- a/kabc/distributionlisteditor.cpp +++ b/kabc/distributionlisteditor.cpp @@ -1,217 +1,221 @@ /* This file is part of libkabc. Copyright (c) 2001 Cornelius Schumacher <schumacher@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 <qlistview.h> #include <qlayout.h> #include <qpushbutton.h> #include <qcombobox.h> +#ifdef DESKTOP_VERSION #include <qinputdialog.h> +#else +#include <qtcompat/qinputdialog.h> +#endif #include <qbuttongroup.h> #include <qradiobutton.h> #include <klocale.h> #include <kdebug.h> #include "addressbook.h" #include "addresseedialog.h" #include "distributionlist.h" #include "distributionlisteditor.h" //US #include "distributionlisteditor.moc" using namespace KABC; EmailSelectDialog::EmailSelectDialog( const QStringList &emails, const QString ¤t, QWidget *parent ) : KDialogBase( KDialogBase::Plain, i18n("Select Email Address"), Ok, Ok, parent ) { QFrame *topFrame = plainPage(); QBoxLayout *topLayout = new QVBoxLayout( topFrame ); mButtonGroup = new QButtonGroup( 1, Horizontal, i18n("Email Addresses"), topFrame ); topLayout->addWidget( mButtonGroup ); QStringList::ConstIterator it; for( it = emails.begin(); it != emails.end(); ++it ) { QRadioButton *button = new QRadioButton( *it, mButtonGroup ); if ( (*it) == current ) { button->setDown( true ); } } } QString EmailSelectDialog::selected() { QButton *button = mButtonGroup->selected(); if ( button ) return button->text(); return QString::null; } QString EmailSelectDialog::getEmail( const QStringList &emails, const QString ¤t, QWidget *parent ) { EmailSelectDialog *dlg = new EmailSelectDialog( emails, current, parent ); dlg->exec(); QString result = dlg->selected(); delete dlg; return result; } class EditEntryItem : public QListViewItem { public: EditEntryItem( QListView *parent, const Addressee &addressee, const QString &email=QString::null ) : QListViewItem( parent ), mAddressee( addressee ), mEmail( email ) { setText( 0, addressee.realName() ); if( email.isEmpty() ) { setText( 1, addressee.preferredEmail() ); setText( 2, i18n("Yes") ); } else { setText( 1, email ); setText( 2, i18n("No") ); } } Addressee addressee() const { return mAddressee; } QString email() const { return mEmail; } private: Addressee mAddressee; QString mEmail; }; DistributionListEditor::DistributionListEditor( AddressBook *addressBook, QWidget *parent) : QWidget( parent ), mAddressBook( addressBook ) { kdDebug(5700) << "DistributionListEditor()" << endl; QBoxLayout *topLayout = new QVBoxLayout( this ); topLayout->setMargin( KDialog::marginHint() ); topLayout->setSpacing( KDialog::spacingHint() ); QBoxLayout *nameLayout = new QHBoxLayout( topLayout) ; mNameCombo = new QComboBox( this ); nameLayout->addWidget( mNameCombo ); connect( mNameCombo, SIGNAL( activated( int ) ), SLOT( updateEntryView() ) ); newButton = new QPushButton( i18n("New List"), this ); nameLayout->addWidget( newButton ); connect( newButton, SIGNAL( clicked() ), SLOT( newList() ) ); removeButton = new QPushButton( i18n("Remove List"), this ); nameLayout->addWidget( removeButton ); connect( removeButton, SIGNAL( clicked() ), SLOT( removeList() ) ); mEntryView = new QListView( this ); mEntryView->addColumn( i18n("Name") ); mEntryView->addColumn( i18n("Email") ); mEntryView->addColumn( i18n("Use Preferred") ); topLayout->addWidget( mEntryView ); connect(mEntryView,SIGNAL(selectionChanged ()),this, SLOT(slotSelectionEntryViewChanged())); changeEmailButton = new QPushButton( i18n("Change Email"), this ); topLayout->addWidget( changeEmailButton ); connect( changeEmailButton, SIGNAL( clicked() ), SLOT( changeEmail() ) ); removeEntryButton = new QPushButton( i18n("Remove Entry"), this ); topLayout->addWidget( removeEntryButton ); connect( removeEntryButton, SIGNAL( clicked() ), SLOT( removeEntry() ) ); addEntryButton = new QPushButton( i18n("Add Entry"), this ); topLayout->addWidget( addEntryButton ); connect( addEntryButton, SIGNAL( clicked() ), SLOT( addEntry() ) ); mAddresseeView = new QListView( this ); mAddresseeView->addColumn( i18n("Name") ); mAddresseeView->addColumn( i18n("Preferred Email") ); topLayout->addWidget( mAddresseeView ); connect(mAddresseeView,SIGNAL(selectionChanged ()),this, SLOT(slotSelectionAddresseeViewChanged())); mManager = new DistributionListManager( mAddressBook ); mManager->load(); updateAddresseeView(); updateNameCombo(); removeButton->setEnabled(!mManager->listNames().isEmpty()); } DistributionListEditor::~DistributionListEditor() { kdDebug(5700) << "~DistributionListEditor()" << endl; mManager->save(); delete mManager; } void DistributionListEditor::slotSelectionEntryViewChanged() { //US EditEntryItem *entryItem = dynamic_cast<EditEntryItem *>( mEntryView->selectedItem() ); EditEntryItem *entryItem = (EditEntryItem *)( mEntryView->selectedItem() ); bool state = (entryItem != 0L); changeEmailButton->setEnabled(state); removeEntryButton->setEnabled(state); } void DistributionListEditor::newList() { bool ok = false; QString name = QInputDialog::getText( i18n("New Distribution List"), i18n("Please enter name:"), QLineEdit::Normal, QString::null, &ok, this ); if ( !ok || name.isEmpty() ) return; new DistributionList( mManager, name ); mNameCombo->insertItem( name ); removeButton->setEnabled(true); updateEntryView(); } void DistributionListEditor::removeList() { delete mManager->list( mNameCombo->currentText() ); mNameCombo->removeItem( mNameCombo->currentItem() ); removeButton->setEnabled(!mManager->listNames().isEmpty()); addEntryButton->setEnabled( !mNameCombo->currentText().isEmpty()); updateEntryView(); diff --git a/kaddressbook/tr.h b/kaddressbook/tr.h new file mode 100644 index 0000000..981e2c1 --- a/dev/null +++ b/kaddressbook/tr.h @@ -0,0 +1,2 @@ +#include <klocale.h> +#define tr i18n diff --git a/korganizer/tr.h b/korganizer/tr.h new file mode 100644 index 0000000..981e2c1 --- a/dev/null +++ b/korganizer/tr.h @@ -0,0 +1,2 @@ +#include <klocale.h> +#define tr i18n |