summaryrefslogtreecommitdiffabout
path: root/kaddressbook/features
authorMichael Krelin <hacker@klever.net>2007-07-04 11:23:42 (UTC)
committer Michael Krelin <hacker@klever.net>2007-07-04 11:23:42 (UTC)
commita08aff328d4393031d5ba7d622c2b05705a89d73 (patch) (side-by-side diff)
tree8ee90d686081c52e7c69b5ce946e9b1a7d690001 /kaddressbook/features
parent11edc920afe4f274c0964436633aa632c8288a40 (diff)
downloadkdepimpi-a08aff328d4393031d5ba7d622c2b05705a89d73.zip
kdepimpi-a08aff328d4393031d5ba7d622c2b05705a89d73.tar.gz
kdepimpi-a08aff328d4393031d5ba7d622c2b05705a89d73.tar.bz2
initial public commit of qt4 portp1
Diffstat (limited to 'kaddressbook/features') (more/less context) (show whitespace changes)
-rw-r--r--kaddressbook/features/distributionlistwidget.cpp39
-rw-r--r--kaddressbook/features/distributionlistwidget.h13
-rw-r--r--kaddressbook/features/mergewidget.cpp14
-rw-r--r--kaddressbook/features/mergewidget.h2
4 files changed, 41 insertions, 27 deletions
diff --git a/kaddressbook/features/distributionlistwidget.cpp b/kaddressbook/features/distributionlistwidget.cpp
index bfcb121..996177b 100644
--- a/kaddressbook/features/distributionlistwidget.cpp
+++ b/kaddressbook/features/distributionlistwidget.cpp
@@ -12,31 +12,38 @@
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 <qbuttongroup.h>
+#include <q3buttongroup.h>
#include <qcombobox.h>
#include <qlabel.h>
#include <qlayout.h>
-#include <qlistview.h>
+#include <q3listview.h>
#include <qpushbutton.h>
#include <qradiobutton.h>
+//Added by qt3to4:
+#include <QDragMoveEvent>
+#include <QDropEvent>
+#include <Q3GridLayout>
+#include <Q3Frame>
+#include <Q3VBoxLayout>
+#include <QDragEnterEvent>
#ifndef KAB_EMBEDDED
#include <kaccelmanager.h>
#endif //KAB_EMBEDDED
#include <kdebug.h>
#include <klineeditdlg.h>
#include <klocale.h>
#include <kglobal.h>
#include <kmessagebox.h>
@@ -68,30 +75,30 @@ class DistributionListFactory : public ExtensionFactory
return "distribution_list_editor";
}
};
extern "C" {
void *init_libkaddrbk_distributionlist()
{
return ( new DistributionListFactory );
}
}
#endif //KAB_EMBEDDED
-class ContactItem : public QListViewItem
+class ContactItem : public Q3ListViewItem
{
public:
ContactItem( DistributionListView *parent, const KABC::Addressee &addressee,
const QString &email = QString::null ) :
- QListViewItem( parent ),
+ Q3ListViewItem( 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" ) );
}
}
@@ -112,25 +119,25 @@ class ContactItem : public QListViewItem
return true;
}
private:
KABC::Addressee mAddressee;
QString mEmail;
};
DistributionListWidget::DistributionListWidget( KABCore *core, QWidget *parent,
const char *name )
: ExtensionWidget( core, parent, name ), mManager( 0 )
{
- QGridLayout *topLayout = new QGridLayout( this, 3, 4, KDialog::marginHint(),
+ Q3GridLayout *topLayout = new Q3GridLayout( this, 3, 4, KDialog::marginHint(),
KDialog::spacingHint() );
if (KGlobal::getOrientation() == KGlobal::Portrait)
{
mCreateListButton = new QPushButton( i18n( "New List" ), this );
mEditListButton = new QPushButton( i18n( "Ren List" ), this );
mRemoveListButton = new QPushButton( i18n( "Del List" ), this );
mAddContactButton = new QPushButton( i18n( "Add Cont." ), this );
mChangeEmailButton = new QPushButton( i18n( "Chge Email" ), this );
mRemoveContactButton = new QPushButton( i18n( "Del Cont." ), this );
}
else
@@ -157,26 +164,26 @@ DistributionListWidget::DistributionListWidget( KABCore *core, QWidget *parent,
mContactView = new DistributionListView( this );
mContactView->addColumn( i18n( "Name" ) );
mContactView->addColumn( i18n( "Email" ) );
mContactView->addColumn( i18n( "Use Preferred" ) );
mContactView->setEnabled( false );
mContactView->setAllColumnsShowFocus( true );
mContactView->setMinimumHeight( 30 );
topLayout->addMultiCellWidget( mContactView, 1, 1, 0, 3 );
connect( mContactView, SIGNAL( selectionChanged() ),
SLOT( selectionContactViewChanged() ) );
- connect( mContactView, SIGNAL( dropped( QDropEvent*, QListViewItem* ) ),
- SLOT( dropped( QDropEvent*, QListViewItem* ) ) );
+ connect( mContactView, SIGNAL( dropped( QDropEvent*, Q3ListViewItem* ) ),
+ SLOT( dropped( QDropEvent*, Q3ListViewItem* ) ) );
mAddContactButton->setEnabled( false );
topLayout->addWidget( mAddContactButton, 2, 0 );
connect( mAddContactButton, SIGNAL( clicked() ), SLOT( addContact() ) );
topLayout->addWidget( mChangeEmailButton, 2, 2 );
connect( mChangeEmailButton, SIGNAL( clicked() ), SLOT( changeEmail() ) );
topLayout->addWidget( mRemoveContactButton, 2, 3 );
connect( mRemoveContactButton, SIGNAL( clicked() ), SLOT( removeContact() ) );
mManager = new KABC::DistributionListManager( core->addressBook() );
@@ -401,101 +408,101 @@ void DistributionListWidget::contactsSelectionChanged()
}
QString DistributionListWidget::title() const
{
return i18n( "Distribution List Editor" );
}
QString DistributionListWidget::identifier() const
{
return "distribution_list_editor";
}
-void DistributionListWidget::dropped( QDropEvent *e, QListViewItem* )
+void DistributionListWidget::dropped( QDropEvent *e, Q3ListViewItem* )
{
dropEvent( e );
}
void DistributionListWidget::changed()
{
save();
}
DistributionListView::DistributionListView( QWidget *parent, const char* name )
: KListView( parent, name )
{
setDragEnabled( true );
setAcceptDrops( true );
setAllColumnsShowFocus( true );
}
void DistributionListView::dragEnterEvent( QDragEnterEvent* e )
{
#ifndef KAB_EMBEDDED
- bool canDecode = QTextDrag::canDecode( e );
+ bool canDecode = Q3TextDrag::canDecode( e );
e->accept( canDecode );
#endif //KAB_EMBEDDED
}
void DistributionListView::viewportDragMoveEvent( QDragMoveEvent *e )
{
#ifndef KAB_EMBEDDED
- bool canDecode = QTextDrag::canDecode( e );
+ bool canDecode = Q3TextDrag::canDecode( e );
e->accept( canDecode );
#endif //KAB_EMBEDDED
}
void DistributionListView::viewportDropEvent( QDropEvent *e )
{
emit dropped( e, 0 );
}
void DistributionListView::dropEvent( QDropEvent *e )
{
emit dropped( e, 0 );
}
EmailSelector::EmailSelector( const QStringList &emails,
const QString &current, QWidget *parent )
: KDialogBase( KDialogBase::Plain, i18n("Select Email Address"), Ok, Ok,
parent )
{
- QFrame *topFrame = plainPage();
- QBoxLayout *topLayout = new QVBoxLayout( topFrame );
+ Q3Frame *topFrame = plainPage();
+ Q3BoxLayout *topLayout = new Q3VBoxLayout( topFrame );
- mButtonGroup = new QButtonGroup( 1, Horizontal, i18n("Email Addresses"),
+ mButtonGroup = new Q3ButtonGroup( 1, Qt::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 EmailSelector::selected()
{
- QButton *button = mButtonGroup->selected();
+ QAbstractButton *button = mButtonGroup->selected();
if ( button )
return button->text();
return QString::null;
}
QString EmailSelector::getEmail( const QStringList &emails,
const QString &current, QWidget *parent )
{
EmailSelector dlg( emails, current, parent );
dlg.exec();
return dlg.selected();
}
-#ifndef KAB_EMBEDDED
-#include "distributionlistwidget.moc"
+#ifndef KAB_EMBEDDED_
+#include "moc_distributionlistwidget.cpp"
#endif //KAB_EMBEDDED
diff --git a/kaddressbook/features/distributionlistwidget.h b/kaddressbook/features/distributionlistwidget.h
index 82bac3d..f619389 100644
--- a/kaddressbook/features/distributionlistwidget.h
+++ b/kaddressbook/features/distributionlistwidget.h
@@ -19,54 +19,59 @@
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.
*/
#ifndef DISTRIBUTIONLISTWIDGET_H
#define DISTRIBUTIONLISTWIDGET_H
#include <kdialogbase.h>
#include <klistview.h>
#include "extensionwidget.h"
+//Added by qt3to4:
+#include <QDragEnterEvent>
+#include <QDropEvent>
+#include <QLabel>
+#include <QDragMoveEvent>
-class QButtonGroup;
+class Q3ButtonGroup;
class QComboBox;
class QLabel;
-class QListView;
+class Q3ListView;
class DistributionListView;
class KABCore;
namespace KABC {
class AddressBook;
class DistributionListManager;
}
class DistributionListWidget : public ExtensionWidget
{
Q_OBJECT
public:
DistributionListWidget( KABCore*, QWidget *parent, const char *name = 0 );
virtual ~DistributionListWidget();
void contactsSelectionChanged();
QString title() const;
QString identifier() const;
public slots:
void save();
- void dropped( QDropEvent*, QListViewItem* );
+ void dropped( QDropEvent*, Q3ListViewItem* );
private slots:
void createList();
void editList();
void removeList();
void addContact();
void removeContact();
void changeEmail();
void updateNameCombo();
void updateContactView();
void selectionContactViewChanged();
void changed();
@@ -111,25 +116,25 @@ class DistributionListView : public KListView
class EmailSelector : public KDialogBase
{
public:
EmailSelector( const QStringList &emails, const QString &current,
QWidget *parent );
QString selected();
static QString getEmail( const QStringList &emails, const QString &current,
QWidget *parent );
private:
- QButtonGroup *mButtonGroup;
+ Q3ButtonGroup *mButtonGroup;
};
#ifdef KAB_EMBEDDED
class DistributionListFactory : public ExtensionFactory
{
public:
ExtensionWidget *extension( KABCore *core, QWidget *parent, const char *name )
{
return new DistributionListWidget( core, parent, name );
}
diff --git a/kaddressbook/features/mergewidget.cpp b/kaddressbook/features/mergewidget.cpp
index 2476e42..1becc2f 100644
--- a/kaddressbook/features/mergewidget.cpp
+++ b/kaddressbook/features/mergewidget.cpp
@@ -14,24 +14,26 @@
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 <qlayout.h>
#include <qpushbutton.h>
+//Added by qt3to4:
+#include <Q3GridLayout>
#ifndef KAB_EMBEDDED
#include <kaccelmanager.h>
#endif //KAB_EMBEDDED
#include <kdebug.h>
#include <klistview.h>
#include <klocale.h>
#include <kglobal.h>
#include <kmessagebox.h>
#include <kabc/addressbook.h>
@@ -54,29 +56,29 @@ class MergeFactory : public ExtensionFactory
return "merge";
}
};
extern "C" {
void *init_libkaddrbk_merge()
{
return ( new MergeFactory );
}
}
#endif //KAB_EMBEDDED
-class ContactItem : public QListViewItem
+class ContactItem : public Q3ListViewItem
{
public:
ContactItem( KListView *parent, const KABC::Addressee &addressee )
- : QListViewItem( parent ), mAddressee( addressee )
+ : Q3ListViewItem( parent ), mAddressee( addressee )
{
KABC::Field::List fieldList = KABC::Field::defaultFields();
KABC::Field::List::ConstIterator it;
int i = 0;
for ( it = fieldList.begin(); it != fieldList.end(); ++it )
setText( i++, (*it)->value( mAddressee ) );
}
KABC::Addressee addressee() const
{
return mAddressee;
@@ -85,25 +87,25 @@ class ContactItem : public QListViewItem
private:
KABC::Addressee mAddressee;
};
MergeWidget::MergeWidget( KABCore *core, QWidget *parent, const char *name )
: ExtensionWidget( core, parent, name ), mBlockUpdate( false )
{
#ifdef KAB_EMBEDDED
if (KGlobal::getOrientation() == KGlobal::Portrait)
parent->setMaximumSize( KGlobal::getDesktopWidth() , 180);
#endif //KAB_EMBEDDED
- QGridLayout *topLayout = new QGridLayout( this, 3, 2, KDialog::marginHint(),
+ Q3GridLayout *topLayout = new Q3GridLayout( this, 3, 2, KDialog::marginHint(),
KDialog::spacingHint() );
mContactView = new KListView( this );
KABC::Field::List fieldList = KABC::Field::defaultFields();
KABC::Field::List::ConstIterator it;
for ( it = fieldList.begin(); it != fieldList.end(); ++it )
mContactView->addColumn( (*it)->label() );
mContactView->setEnabled( false );
mContactView->setAllColumnsShowFocus( true );
topLayout->addMultiCellWidget( mContactView, 0, 2, 0, 0 );
@@ -205,25 +207,25 @@ void MergeWidget::mergeAndRemove()
if ( !item )
return;
QString oldUID = item->addressee().uid();
doMerge( item->addressee() );
KABC::Addressee::List retval;
retval << mMasterAddressee;
emit modified( retval );
mBlockUpdate = true;
- core()->deleteContacts( oldUID );
+ core()->deleteContacts( QStringList(oldUID) );
core()->setContactSelected( mMasterAddressee.uid() );
mBlockUpdate = false;
updateView();
}
void MergeWidget::merge()
{
#ifndef KAB_EMBEDDED
ContactItem *item = dynamic_cast<ContactItem*>( mContactView->currentItem() );
#else //KAB_EMBEDDED
ContactItem *item = (ContactItem*)( mContactView->currentItem() );
@@ -360,15 +362,15 @@ void MergeWidget::doMerge( const KABC::Addressee &addr )
mMasterAddressee.setUrl( addr.url() );
// X-
QStringList customs = addr.customs();
QStringList masterCustoms = mMasterAddressee.customs();
QStringList newCustoms( masterCustoms );
for ( it = customs.begin(); it != customs.end(); ++it )
if ( !masterCustoms.contains( *it ) )
newCustoms.append( *it );
mMasterAddressee.setCustoms( newCustoms );
}
-#ifndef KAB_EMBEDDED
-#include "mergewidget.moc"
+#ifndef KAB_EMBEDDED_
+#include "moc_mergewidget.cpp"
#endif //KAB_EMBEDDED
diff --git a/kaddressbook/features/mergewidget.h b/kaddressbook/features/mergewidget.h
index 1063c80..bb16282 100644
--- a/kaddressbook/features/mergewidget.h
+++ b/kaddressbook/features/mergewidget.h
@@ -20,25 +20,25 @@
with any edition of Qt, and distribute the resulting executable,
without including the source code for Qt in the source distribution.
*/
#ifndef MERGEWIDGET_H
#define MERGEWIDGET_H
#include <kdialogbase.h>
#include <klistview.h>
#include "extensionwidget.h"
-class QListView;
+class Q3ListView;
class KABCore;
namespace KABC {
class AddressBook;
}
class MergeWidget : public ExtensionWidget
{
Q_OBJECT
public: