--Boundary-00=_xX8w+RKq/iAIHjE Content-Type: Text/Plain; charset="iso-8859-15" Content-Transfer-Encoding: quoted-printable Content-Description: clearsigned data Content-Disposition: inline =2D----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 Hi. I made a patch for KDesktop to allow it to auto - line up the icons. Wh= en=20 an user moves an icon, with this patch the icon is automatically lined up=20 into the grid (as he rclicked on the desktop, selected icons, and then line= =20 up). Of course there's a check box in the right menu to allow the user to=20 disable it. What do you think? Will you apply it? PS: It's made in a bit strange format I think, because my Kate thrown away= =20 some tabs, and I fixed the patch created from CVS manually... hope it will= =20 works anyway. Bye =2D --=20 Andrea Bergia - studente Linux Registered User #281550 =2D----BEGIN PGP SIGNATURE----- Version: GnuPG v1.2.1 (GNU/Linux) iD8DBQE+w8Xx/QsGXRtKyZkRAl88AJ0Z0NBdyXgrg3fe9TWWmHaZuYh34ACeLtMG AimopEazXsNLpbc/Itp1vZ8=3D =3DtoDp =2D----END PGP SIGNATURE----- --Boundary-00=_xX8w+RKq/iAIHjE Content-Type: text/x-diff; charset="iso-8859-15"; name="icons-auto-line-up.patch" Content-Transfer-Encoding: 7bit Content-Disposition: attachment; filename="icons-auto-line-up.patch" Index: desktop.cc =================================================================== RCS file: /home/kde/kdebase/kdesktop/desktop.cc,v retrieving revision 1.272 diff -u -r1.272 desktop.cc --- desktop.cc 8 May 2003 13:50:35 -0000 1.272 +++ desktop.cc 15 May 2003 16:39:38 -0000 @@ -600,6 +600,10 @@ m_pIconView->slotSaveIconPositions(); if ( m_miniCli ) m_miniCli->saveConfig(); + + // Save the auto-lineup setting + if ( KRootWm::self() ) + KRootWm::self()->saveConfig(); } // don't hide when someone presses Alt-F4 on us Index: kdiconview.cc =================================================================== RCS file: /home/kde/kdebase/kdesktop/kdiconview.cc,v retrieving revision 1.76 diff -u -r1.76 kdiconview.cc --- kdiconview.cc 13 May 2003 15:34:44 -0000 1.76 +++ kdiconview.cc 15 May 2003 16:39:41 -0000 @@ -438,6 +438,12 @@ KonqIconViewWidget::wheelEvent( e ); } +void KDIconView::startDrag() +{ + KonqIconViewWidget::startDrag(); + emit iconMoved(); +} + void KDIconView::slotMouseButtonPressed(int _button, QIconViewItem* _item, const QPoint& _global) { //kdDebug(1204) << "KDIconView::slotMouseButtonPressed" << endl; Index: kdiconview.h =================================================================== RCS file: /home/kde/kdebase/kdesktop/kdiconview.h,v retrieving revision 1.23 diff -u -r1.23 kdiconview.h --- kdiconview.h 8 May 2003 11:48:41 -0000 1.23 +++ kdiconview.h 15 May 2003 16:39:41 -0000 @@ -57,10 +57,14 @@ * Re-arrange the desktop icons without confirmation. */ void rearrangeIcons(); + +public slots: /** * Lineup the desktop icons. */ void lineupIcons(); + +public: void lineupIcons(QIconView::Arrangement); void refreshIcons(); @@ -117,6 +121,7 @@ void colorDropEvent( QDropEvent *e ); void imageDropEvent( QDropEvent *e ); void newWallpaper( const KURL & ); + void iconMoved(); public slots: // for krootwm void slotPaste(); @@ -142,9 +147,12 @@ virtual void mousePressEvent( QMouseEvent *e ); virtual void wheelEvent( QWheelEvent* e ); + /** Used to emit a iconMoved event, to auto - line up icons. */ + virtual void startDrag(); + private slots: void desktopResized(); - + private: /** Our action collection, parent of all our actions */ KActionCollection m_actionCollection; Index: krootwm.cc =================================================================== RCS file: /home/kde/kdebase/kdesktop/krootwm.cc,v retrieving revision 1.173 diff -u -r1.173 krootwm.cc --- krootwm.cc 10 May 2003 17:52:07 -0000 1.173 +++ krootwm.cc 15 May 2003 16:39:43 -0000 @@ -49,6 +49,7 @@ #include #include #include +#include #include "krootwm.h" #include "kdiconview.h" @@ -153,15 +154,19 @@ KToggleAction *aSortDirsFirst = new KToggleAction( i18n("Directories First"), 0, m_actionCollection, "sort_directoriesfirst" ); aSortDirsFirst->setChecked(true); // - new KAction(i18n("Line Up Horizontally"), 0, + new KAction(i18n("Line Up Horizontally"), 0, this, SLOT( slotLineupIconsHoriz() ), m_actionCollection, "lineupHoriz" ); new KAction(i18n("Line Up Vertically"), 0, this, SLOT( slotLineupIconsVert() ), m_actionCollection, "lineupVert" ); + new KAction(i18n("Align to Grid"), 0, this, SLOT( slotLineupIcons() ), m_actionCollection, "realign" ); + new KToggleAction(i18n("Automatical align to the Grid"), 0, + this, SLOT( slotAutoLineupIcons() ), + m_actionCollection, "autorealign" ); } if (m_bDesktopEnabled) { @@ -233,9 +238,23 @@ if (s == s_choices[c]) { rightButtonChoice = (menuChoice) c; break; } + // Reset the auto-lineup config - what a horrible C++! + (static_cast + (m_actionCollection->action("autorealign")))->setChecked( + kconfig->readBoolEntry("AutoLineUpIcons", false)); + slotAutoLineupIcons(); + buildMenus(); } +void KRootWm::saveConfig() +{ + // Save the auto-lineup config + KConfig *kconfig = KGlobal::config(); + kconfig->writeEntry("AutoLineUpIcons", (static_cast + (m_actionCollection->action("autorealign")))->isChecked()); +} + void KRootWm::buildMenus() { // kdDebug() << "KRootWm::buildMenus" << endl; @@ -277,6 +296,7 @@ m_actionCollection->action( "lineupVert" )->plug( pLineupMenu ); pLineupMenu->insertSeparator(); m_actionCollection->action( "realign" )->plug( pLineupMenu ); + m_actionCollection->action( "autorealign" )->plug( pLineupMenu ); } if (menuBar) { @@ -586,6 +607,30 @@ } } +void KRootWm::slotAutoLineupIcons() { + if (m_bDesktopEnabled) + { + bool arr = (dynamic_cast + (m_actionCollection->action("autorealign")))->isChecked(); + m_actionCollection->action("realign")->setEnabled(! arr); + + if (arr) + { + // Line up now, and set to do it automatically + m_pDesktop->iconView()->lineupIcons(); + + connect (m_pDesktop->iconView(), SIGNAL (iconMoved()), + m_pDesktop->iconView(), SLOT (lineupIcons())); + } + else + { + // Stop + disconnect (m_pDesktop->iconView(), SIGNAL (iconMoved()), + m_pDesktop->iconView(), SLOT (lineupIcons())); + } + } +} + void KRootWm::slotRefreshDesktop() { if (m_bDesktopEnabled) { Index: krootwm.h =================================================================== RCS file: /home/kde/kdebase/kdesktop/krootwm.h,v retrieving revision 1.50 diff -u -r1.50 krootwm.h --- krootwm.h 3 Oct 2002 11:45:59 -0000 1.50 +++ krootwm.h 15 May 2003 16:39:44 -0000 @@ -88,6 +88,11 @@ */ void initConfig(); + /** + * Save some settings. By now saves only the auto-lineup setting + */ + void saveConfig(); + public slots: void slotArrangeByNameCS(); void slotArrangeByNameCI(); @@ -96,6 +101,7 @@ void slotLineupIconsHoriz(); void slotLineupIconsVert(); void slotLineupIcons(); + void slotAutoLineupIcons(); void slotRefreshDesktop(); void slotConfigureDesktop(); void slotToggleDesktopMenu(); --Boundary-00=_xX8w+RKq/iAIHjE Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Disposition: inline >> Visit http://mail.kde.org/mailman/listinfo/kde-devel#unsub to unsubscribe << --Boundary-00=_xX8w+RKq/iAIHjE--