[PATCH] resolution depended icon positions

Tobias Koenig tokoe at kde.org
Tue Aug 5 21:55:41 BST 2003


Hi,

the attached patch adds resolution depended icon positions to kdesktop.
I think this is a usefull addition to the rand extension, because
switching between two resolution mixes up the icon positions atm.

Ok for commit?
I'm not sure if it works with Xinerama... George?

Ciao,
Tobias
-- 
Can a government that shoots at reporters be democratic?
Seperate politics from religion and economy!
-------------- next part --------------
Index: libkonq/konq_iconviewwidget.cc
===================================================================
RCS file: /home/kde/kdebase/libkonq/konq_iconviewwidget.cc,v
retrieving revision 1.248
diff -p -u -b -r1.248 konq_iconviewwidget.cc
--- libkonq/konq_iconviewwidget.cc	2 Aug 2003 04:17:39 -0000	1.248
+++ libkonq/konq_iconviewwidget.cc	5 Aug 2003 20:49:06 -0000
@@ -1366,8 +1366,8 @@ void KonqIconViewWidget::slotSaveIconPos
 
     dotDirectory.setGroup( QString( m_iconPositionGroupPrefix ).append( item->url().fileName() ) );
     kdDebug(1214) << "KonqIconViewWidget::slotSaveIconPositions " << item->url().fileName() << " " << it->x() << " " << it->y() << endl;
-    dotDirectory.writeEntry( "X", it->x() );
-    dotDirectory.writeEntry( "Y", it->y() );
+    dotDirectory.writeEntry( QString( "X %1" ).arg( width() ), it->x() );
+    dotDirectory.writeEntry( QString( "Y %1" ).arg( height() ), it->y() );
     dotDirectory.writeEntry( "Exists", true );
 
     it = it->nextItem();
Index: kdesktop/kdiconview.cc
===================================================================
RCS file: /home/kde/kdebase/kdesktop/kdiconview.cc,v
retrieving revision 1.83
diff -p -u -b -r1.83 kdiconview.cc
--- kdesktop/kdiconview.cc	3 Jul 2003 08:36:26 -0000	1.83
+++ kdesktop/kdiconview.cc	5 Aug 2003 20:49:11 -0000
@@ -243,7 +243,6 @@ void KDIconView::start()
     createActions();
 }
 
-
 void KDIconView::configureDevices()
 {
 #if !(defined(Q_OS_LINUX) || defined(Q_OS_FREEBSD))
@@ -337,8 +336,10 @@ void KDIconView::lineupIcons()
 
 void KDIconView::desktopResized()
 {
-    resize( kapp->desktop()->size());
-    lineupIcons();
+    slotSaveIconPositions();
+    resize( kapp->desktop()->size() );
+    slotClear();
+    m_dirLister->openURL( url() );
 }
 
 void KDIconView::lineupIcons(QIconView::Arrangement align)
@@ -691,6 +692,8 @@ void KDIconView::slotNewItems( const KFi
     }
     else if ( m_dotDirectory )
     {
+      QRect desk = QApplication::desktop()->screenGeometry( kdesktop_screen_number );
+
       kdDebug(1214) << "slotNewItems : trying to read position from .directory file"<<endl;
       QString group = iconPositionGroupPrefix();
       QString filename = it.current()->url().fileName();
@@ -702,8 +705,12 @@ void KDIconView::slotNewItems( const KFi
       {
         m_dotDirectory->setGroup( group );
         m_hasExistingPos = true;
-        int x = m_dotDirectory->readNumEntry( "X" );
-        int y = m_dotDirectory->readNumEntry( "Y" );
+        int x = m_dotDirectory->readNumEntry( QString( "X %1" ).arg( desk.width() ), -1 );
+        if ( x == -1 )
+          x = m_dotDirectory->readNumEntry( "X" );
+        int y = m_dotDirectory->readNumEntry( QString( "Y %1" ).arg( desk.height() ), -1 );
+        if ( y == -1 )
+          y = m_dotDirectory->readNumEntry( "Y" );
 
         kdDebug(1214)<<"slotNewItems() x: "<<x<<" y: "<<y<<endl;
 
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: not available
URL: <http://mail.kde.org/pipermail/kde-core-devel/attachments/20030805/d800cf3b/attachment.sig>


More information about the kde-core-devel mailing list