[prev in list] [next in list] [prev in thread] [next in thread]
List: kfm-devel
Subject: Re: [PATCH for bug:50902] icon rows' top margins not updated until
From: Luis Pedro Coelho <luis_pedro () netcabo ! pt>
Date: 2003-08-16 20:17:41
[Download RAW message or body]
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
> Ok to commit?
I just committed a fix to HEAD (following a two day timeout on kfm-devel).
I attach a manual applying of the patch, since it didn't apply automatically.
This one I will _not_ apply without an explicit OK, since I do not run BRANCH
(not enough disk for two kde trees, sorry).
It does seem to work in a mixed environment (kdebase/libkonq from branch,
everything else from head), but I am wary of breaking anything.
so, ok to commit?
- --
Luis Pedro Coelho
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.0.7 (GNU/Linux)
iD8DBQE/PpFyGpBAvyRwXdgRAhrRAJsFdQvrmzsz+iPjuYt5JNDlCPzNKQCgnc2X
6xULkxEqgdHQc3mTY/GwJIY=
=wpLP
-----END PGP SIGNATURE-----
["diff-to-branch" (text/x-diff)]
Index: konq_iconviewwidget.cc
===================================================================
RCS file: /home/kde/kdebase/libkonq/konq_iconviewwidget.cc,v
retrieving revision 1.219.2.13
diff -u -3 -p -r1.219.2.13 konq_iconviewwidget.cc
--- konq_iconviewwidget.cc 27 Jun 2003 15:26:03 -0000 1.219.2.13
+++ konq_iconviewwidget.cc 16 Aug 2003 20:10:57 -0000
@@ -319,7 +319,6 @@ struct KonqIconViewWidgetPrivate
pSoundTimer = 0;
pPreviewJob = 0;
bAllowSetWallpaper = false;
- updateAfterPreview = false;
gridXspacing = 50;
doAnimations = true;
@@ -342,9 +341,10 @@ struct KonqIconViewWidgetPrivate
bool bSoundPreviews;
bool bSoundItemClicked;
bool bAllowSetWallpaper;
- bool updateAfterPreview;
int gridXspacing;
+ QTimer* rearrangeIconsTimer;
+
// Animated icons support
bool doAnimations;
QMovie* m_movie;
@@ -363,6 +363,7 @@ KonqIconViewWidget::KonqIconViewWidget(
m_bSetGridX( !kdesktop ) /* No line breaking on the desktop */
{
d = new KonqIconViewWidgetPrivate;
+ d->rearrangeIconsTimer = new QTimer( this );
connect( this, SIGNAL( dropped( QDropEvent *, const QValueList<QIconDragItem> & \
) ),
this, SLOT( slotDropped( QDropEvent*, const QValueList<QIconDragItem> & \
) ) );
@@ -375,6 +376,8 @@ KonqIconViewWidget::KonqIconViewWidget(
connect( this, SIGNAL(onViewport()), SLOT(slotOnViewport()) );
connect( this, SIGNAL(itemRenamed(QIconViewItem *, const QString &)), \
SLOT(slotItemRenamed(QIconViewItem *, const QString &)) );
+ connect( d->rearrangeIconsTimer, SIGNAL( timeout() ), SLOT( slotRearrangeIcons() \
) ); +
// hardcoded settings
setSelectionMode( QIconView::Extended );
setItemTextPos( QIconView::Bottom );
@@ -646,21 +649,23 @@ void KonqIconViewWidget::slotPreview(con
// ### slow. Idea: move KonqKfmIconView's m_itemDict into this class
for (QIconViewItem *it = firstItem(); it; it = it->nextItem())
{
- if (static_cast<KFileIVI *>(it)->item() == item)
+ if (static_cast<KFileIVI *>(it)->item() == item) {
+ bool needsUpdate = ( static_cast<KFileIVI*>( it )->width() < pix.width() \
) || ( static_cast<KFileIVI*>( it )->height() < pix.height() ); static_cast<KFileIVI \
*>(it)->setThumbnailPixmap(pix);
- {
- }
- d->updateAfterPreview = true;
+ if ( autoArrange() && !d->rearrangeIconsTimer->isActive() ) {
+ if ( needsUpdate ) d->rearrangeIconsTimer->start( 500, true );
+ }
}
+ }
}
void KonqIconViewWidget::slotPreviewResult()
{
d->pPreviewJob = 0;
emit imagePreviewFinished();
- if (autoArrange() && d->updateAfterPreview ) {
+ if (d->rearrangeIconsTimer->isActive() ){
+ d->rearrangeIconsTimer->stop();
arrangeItemsInGrid();
- d->updateAfterPreview = false;
}
}
@@ -1021,6 +1026,13 @@ void KonqIconViewWidget::slotDropped( QD
{
// Drop on background
KonqOperations::doDrop( m_rootItem /* may be 0L */, url(), ev, this );
+}
+
+
+void KonqIconViewWidget::slotRearrangeIcons()
+{
+ // We cannot actually call arrangeItemsInGrid directly as a slot because it has \
a default parameter. + arrangeItemsInGrid();
}
void KonqIconViewWidget::drawBackground( QPainter *p, const QRect &r )
Index: konq_iconviewwidget.h
===================================================================
RCS file: /home/kde/kdebase/libkonq/konq_iconviewwidget.h,v
retrieving revision 1.93
diff -u -3 -p -r1.93 konq_iconviewwidget.h
--- konq_iconviewwidget.h 3 Nov 2002 23:46:21 -0000 1.93
+++ konq_iconviewwidget.h 16 Aug 2003 20:10:57 -0000
@@ -251,6 +251,9 @@ protected slots:
void slotMovieStatus( int status );
void slotReenableAnimation();
+private slots:
+ void slotRearrangeIcons();
+
protected:
virtual QDragObject *dragObject();
KonqIconDrag *konqDragObject( QWidget * dragSource = 0L );
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic