* port K3URLDrag

* port Q3IconView
* fix icon
* do not link anymore against kde3support lib
* cleanup code

svn path=/trunk/KDE/kdebase/apps/; revision=752228
This commit is contained in:
Urs Wolfer 2007-12-23 22:58:09 +00:00
parent bc54c6cdda
commit ad44b09500
12 changed files with 58 additions and 101 deletions

View file

@ -1,20 +1,13 @@
add_subdirectory(kcm)
add_subdirectory( kcm )
########### next target ###############
set(kdepasswd_SRCS kdepasswd.cpp passwd.cpp passwddlg.cpp )
set(kdepasswd_SRCS
kdepasswd.cpp
passwd.cpp
passwddlg.cpp)
kde4_add_executable(kdepasswd ${kdepasswd_SRCS})
target_link_libraries(kdepasswd ${KDE4_KIO_LIBS} ${KDE4_KDESU_LIBS} )
target_link_libraries(kdepasswd ${KDE4_KIO_LIBS} ${KDE4_KDESU_LIBS})
install(TARGETS kdepasswd DESTINATION ${BIN_INSTALL_DIR})
########### install files ###############
install( FILES kdepasswd.desktop DESTINATION ${XDG_APPS_INSTALL_DIR} )
install(FILES kdepasswd.desktop DESTINATION ${XDG_APPS_INSTALL_DIR})

View file

@ -1,29 +1,22 @@
add_subdirectory(pics)
add_subdirectory( pics )
add_definitions(-DQT3_SUPPORT)
set(kcm_useraccount_PART_SRCS
chfnprocess.cpp
main.cpp
chfacedlg.cpp)
########### next target ###############
kde4_add_ui_files(kcm_useraccount_PART_SRCS
main_widget.ui
faceDlg.ui)
set(kcm_useraccount_PART_SRCS chfnprocess.cpp main.cpp chfacedlg.cpp )
kde4_add_ui_files(kcm_useraccount_PART_SRCS main_widget.ui faceDlg.ui)
kde4_add_kcfg_files(kcm_useraccount_PART_SRCS settings.kcfgc )
kde4_add_kcfg_files(kcm_useraccount_PART_SRCS settings.kcfgc)
kde4_add_plugin(kcm_useraccount ${kcm_useraccount_PART_SRCS})
target_link_libraries(kcm_useraccount konq ${KDE4_KDESU_LIBS})
target_link_libraries(kcm_useraccount konq ${KDE4_KDE3SUPPORT_LIBS} ${KDE4_KDESU_LIBS} )
install(TARGETS kcm_useraccount DESTINATION ${PLUGIN_INSTALL_DIR} )
########### install files ###############
install( FILES kcm_useraccount.desktop DESTINATION ${SERVICES_INSTALL_DIR} )
install( FILES kcm_useraccount.kcfg DESTINATION ${KCFG_INSTALL_DIR} )
kde4_install_icons( ${ICON_INSTALL_DIR} )
install(TARGETS kcm_useraccount DESTINATION ${PLUGIN_INSTALL_DIR})
install(FILES kcm_useraccount.desktop DESTINATION ${SERVICES_INSTALL_DIR})
install(FILES kcm_useraccount.kcfg DESTINATION ${KCFG_INSTALL_DIR})
kde4_install_icons(${ICON_INSTALL_DIR})

View file

@ -34,12 +34,9 @@
#include <QtGui/QPushButton>
#include <QtCore/QDir>
#include <QtGui/QCheckBox>
//Added by qt3to4:
#include <QtGui/QBoxLayout>
#include <klocale.h>
#include <kfiledialog.h>
#include <k3iconview.h>
#include <kimagefilepreview.h>
#include <kimageio.h>
#include <kmessagebox.h>
@ -53,11 +50,9 @@
/**
* TODO: It would be nice if the widget were in a .ui
*/
ChFaceDlg::ChFaceDlg(const QString& picsdir, QWidget *parent, const char *name, bool modal)
ChFaceDlg::ChFaceDlg(const QString& picsdir, QWidget *parent)
: KDialog( parent )
{
setObjectName( name );
setModal( modal );
setCaption( i18n("Change your Face") );
setButtons( Ok|Cancel );
setDefaultButton( Ok );
@ -68,9 +63,9 @@ ChFaceDlg::ChFaceDlg(const QString& picsdir, QWidget *parent, const char *name,
setMainWidget(faceDlg);
connect( ui.m_FacesWidget, SIGNAL( selectionChanged( Q3IconViewItem * ) ), SLOT( slotFaceWidgetSelectionChanged( Q3IconViewItem * ) ) );
connect( ui.m_FacesWidget, SIGNAL( currentItemChanged( QListWidgetItem *, QListWidgetItem * ) ), SLOT( slotFaceWidgetSelectionChanged( QListWidgetItem * ) ) );
connect( ui.m_FacesWidget, SIGNAL( doubleClicked( Q3IconViewItem *, const QPoint & ) ), SLOT(accept()) );
connect( ui.m_FacesWidget, SIGNAL( doubleClicked( const QModelIndex & ) ), SLOT(accept()) );
connect( this, SIGNAL(okClicked()), this, SLOT(accept()));
connect( ui.browseBtn, SIGNAL( clicked() ), SLOT( slotGetCustomImage() ) );
@ -87,16 +82,17 @@ ChFaceDlg::ChFaceDlg(const QString& picsdir, QWidget *parent, const char *name,
{
QStringList picslist = facesDir.entryList( QDir::Files );
for ( QStringList::Iterator it = picslist.begin(); it != picslist.end(); ++it )
new Q3IconViewItem( ui.m_FacesWidget, (*it).section(".",0,0), QPixmap( picsdir + *it ) );
new QListWidgetItem( QIcon( picsdir + *it ), (*it).section(".",0,0), ui.m_FacesWidget );
}
facesDir.setPath( KCFGUserAccount::userFaceDir() );
if ( facesDir.exists() )
{
QStringList picslist = facesDir.entryList( QDir::Files );
for ( QStringList::Iterator it = picslist.begin(); it != picslist.end(); ++it )
new Q3IconViewItem( ui.m_FacesWidget, '/'+(*it) == KCFGUserAccount::customFaceFile() ?
i18n("(Custom)") : (*it).section(".",0,0),
QPixmap( KCFGUserAccount::userFaceDir() + *it ) );
new QListWidgetItem( QIcon( KCFGUserAccount::userFaceDir() + *it ),
'/'+(*it) == KCFGUserAccount::customFaceFile() ?
i18n("(Custom)") : (*it).section(".",0,0),
ui.m_FacesWidget );
}
@ -136,9 +132,8 @@ void ChFaceDlg::addCustomPixmap( const QString &imPath, bool saveCopy )
#endif
}
Q3IconViewItem* newface = new Q3IconViewItem( ui.m_FacesWidget, QFileInfo(imPath).fileName().section(".",0,0), QPixmap::fromImage(pix) );
newface->setKey( KCFGUserAccount::customKey() );// Add custom items to end
ui.m_FacesWidget->ensureItemVisible( newface );
QListWidgetItem* newface = new QListWidgetItem( QIcon(QPixmap::fromImage(pix)), QFileInfo(imPath).fileName().section(".",0,0), ui.m_FacesWidget );
ui.m_FacesWidget->scrollToItem( newface );
ui.m_FacesWidget->setCurrentItem( newface );
}

View file

@ -32,7 +32,6 @@
#include <QtGui/QPixmap>
#include <KDialog>
#include <K3IconView> // declaration below
#include "ui_faceDlg.h"
@ -45,22 +44,20 @@ public:
explicit ChFaceDlg(const QString& picsdirs,
QWidget *parent=0,
const char *name=0,
bool modal=true);
QWidget *parent=0);
QPixmap getFaceImage() const
{
if(ui.m_FacesWidget->currentItem())
return *(ui.m_FacesWidget->currentItem()->pixmap());
return ui.m_FacesWidget->currentItem()->icon().pixmap(64);
else
return QPixmap();
}
private Q_SLOTS:
void slotFaceWidgetSelectionChanged( Q3IconViewItem *item )
{ enableButton( Ok, !item->pixmap()->isNull() ); }
void slotFaceWidgetSelectionChanged( QListWidgetItem *item )
{ enableButton( Ok, !item->icon().isNull() ); }
void slotGetCustomImage();
//void slotSaveCustomImage();

View file

@ -26,12 +26,18 @@
</widget>
</item>
<item>
<widget class="Q3IconView" name="m_FacesWidget" >
<property name="resizeMode" >
<enum>Q3IconView::Adjust</enum>
<widget class="QListWidget" name="m_FacesWidget" >
<property name="iconSize" >
<size>
<width>64</width>
<height>64</height>
</size>
</property>
<property name="itemsMovable" >
<bool>false</bool>
<property name="resizeMode" >
<enum>QListView::Adjust</enum>
</property>
<property name="viewMode" >
<enum>QListView::IconMode</enum>
</property>
</widget>
</item>
@ -63,13 +69,6 @@
</item>
</layout>
</widget>
<customwidgets>
<customwidget>
<class>Q3IconView</class>
<extends>Q3Frame</extends>
<header>q3iconview.h</header>
</customwidget>
</customwidgets>
<resources/>
<connections/>
</ui>

View file

@ -28,9 +28,7 @@
#include <QtCore/QEvent>
#include <QtGui/QPixmap>
#include <QtCore/QStringList>
//Added by qt3to4:
#include <QtGui/QKeyEvent>
#include <QtGui/QBoxLayout>
#include <QtGui/QDragEnterEvent>
#include <kpushbutton.h>
#include <kguiitem.h>
@ -45,7 +43,6 @@
#include <QProcess>
#include <kio/netaccess.h>
#include <kurl.h>
#include <k3urldrag.h>
#include "settings.h"
#include "chfnprocess.h"
@ -69,7 +66,7 @@ KCMUserAccount::KCMUserAccount( QWidget *parent, const QVariantList &)
connect( _mw->btnChangeFace, SIGNAL(clicked()), SLOT(slotFaceButtonClicked()));
connect( _mw->btnChangePassword, SIGNAL(clicked()), SLOT(slotChangePassword()));
_mw->btnChangePassword->setGuiItem( KGuiItem( i18n("Change &Password..."), "password" ));
_mw->btnChangePassword->setGuiItem( KGuiItem( i18n("Change &Password..."), "preferences-desktop-user-password" ));
connect( _mw->leRealname, SIGNAL(textChanged(const QString&)), SLOT(changed()));
connect( _mw->leOrganization, SIGNAL(textChanged(const QString&)), SLOT(changed()));
@ -291,7 +288,7 @@ bool KCMUserAccount::eventFilter(QObject *, QEvent *e)
if (e->type() == QEvent::DragEnter)
{
QDragEnterEvent *ee = (QDragEnterEvent *) e;
if ( K3URLDrag::canDecode( ee ) )
if (!KUrl::List::fromMimeData( ee->mimeData() ).isEmpty())
ee->accept();
else
ee->ignore();
@ -323,9 +320,8 @@ bool KCMUserAccount::eventFilter(QObject *, QEvent *e)
inline KUrl *KCMUserAccount::decodeImgDrop(QDropEvent *e, QWidget *wdg)
{
KUrl::List uris;
if (K3URLDrag::decode(e, uris) && (uris.count() > 0))
KUrl::List uris = KUrl::List::fromMimeData(e->mimeData());
if (!uris.isEmpty())
{
KUrl *url = new KUrl(uris.first());

View file

@ -23,10 +23,6 @@
#include <kemailsettings.h>
#include "ui_main_widget.h"
//Added by qt3to4:
#include <QtGui/QPixmap>
#include <QtCore/QEvent>
#include <QtGui/QKeyEvent>
#include "chfacedlg.h"

View file

@ -1,6 +1,4 @@
/* vi: ts=8 sts=4 sw=4
*
* $Id$
*
* This file is part of the KDE project, module kdesu.
* Copyright (C) 2000 Geert Jansen <jansen@kde.org>
@ -25,7 +23,7 @@ int main(int argc, char **argv)
KDE_VERSION_STRING, ki18n("Changes a UNIX password."),
KAboutData::License_Artistic, ki18n("Copyright (c) 2000 Geert Jansen"));
aboutData.addAuthor(ki18n("Geert Jansen"), ki18n("Maintainer"),
"jansen@kde.org", "http://www.stack.nl/~geertj/");
"jansen@kde.org");
KCmdLineArgs::init(argc, argv, &aboutData);

View file

@ -1,6 +1,4 @@
/* vi: ts=8 sts=4 sw=4
*
* $Id$
*
* This file is part of the KDE project, module kdesu.
* Copyright (C) 1999,2000 Geert Jansen <jansen@kde.org>
@ -273,5 +271,3 @@ bool PasswdProcess::isPrompt(const QByteArray &line, const char *word)
return true;
return line.toLower().contains(word);
}

View file

@ -1,13 +1,11 @@
/* vi: ts=8 sts=4 sw=4
*
* $Id$
*
* This file is part of the KDE project, module kdesu.
* Copyright (C) 2000 Geert Jansen <jansen@kde.org>
*/
#ifndef __Passwd_h_Included__
#define __Passwd_h_Included__
#ifndef PASSWD_H
#define PASSWD_H
#include <QtCore/QByteRef>
#include <kdesu/process.h>
@ -40,4 +38,4 @@ private:
};
#endif // __Passwd_h_Included__
#endif // PASSWD_H

View file

@ -1,6 +1,4 @@
/* vi: ts=8 sts=4 sw=4
*
* $Id$
*
* This file is part of the KDE project, module kdesu.
* Copyright (C) 2000 Geert Jansen <jansen@kde.org>

View file

@ -1,13 +1,11 @@
/* vi: ts=8 sts=4 sw=4
*
* $Id$
*
* This file is part of the KDE project, module kdesu.
* Copyright (C) 2000 Geert Jansen <jansen@kde.org>
*/
#ifndef __PasswdDlg_h_Incluced__
#define __PasswdDlg_h_Incluced__
#ifndef PASSWDDLG_H
#define PASSWDDLG_H
#include <kpassworddialog.h>
#include <knewpassworddialog.h>
@ -50,4 +48,4 @@ private:
#endif // __PasswdDlg_h_Incluced__
#endif // PASSWDDLG_H