diff options
author | Timothy Pearson <kb9vqf@pearsoncomputing.net> | 2012-05-23 18:20:09 -0500 |
---|---|---|
committer | Timothy Pearson <kb9vqf@pearsoncomputing.net> | 2012-05-23 18:20:09 -0500 |
commit | de4e7b41598b4c8db0948e4c2c216d73e952f7bb (patch) | |
tree | b8772c60b0b57c16d2e0055697ca95bff623d2eb | |
parent | c281f8a59d6d1cc7d72d6fed23a11ee785988e1c (diff) | |
download | tdebase-de4e7b41598b4c8db0948e4c2c216d73e952f7bb.tar.gz tdebase-de4e7b41598b4c8db0948e4c2c216d73e952f7bb.zip |
Add support to Kate for saving/restoring manual document placement
Make absolutely sure that kdesktop_lock reads recently changed configuration files when starting up
-rw-r--r-- | kate/app/katedocmanager.cpp | 3 | ||||
-rw-r--r-- | kate/app/katefilelist.cpp | 24 | ||||
-rw-r--r-- | kate/app/katefilelist.h | 1 | ||||
-rw-r--r-- | kate/app/kateviewspace.cpp | 5 | ||||
-rw-r--r-- | kdesktop/lock/main.cc | 20 |
5 files changed, 42 insertions, 11 deletions
diff --git a/kate/app/katedocmanager.cpp b/kate/app/katedocmanager.cpp index f9158dc1c..f23d5abba 100644 --- a/kate/app/katedocmanager.cpp +++ b/kate/app/katedocmanager.cpp @@ -455,7 +455,8 @@ void KateDocManager::saveDocumentList (KConfig* config) int i=0; for ( Kate::Document *doc = m_docList.first(); doc; doc = m_docList.next() ) { - config->setGroup(TQString("Document %1").arg(i)); + long docListPos = doc->documentListPosition(); + config->setGroup(TQString("Document %1").arg((docListPos<0)?i:docListPos)); doc->writeSessionConfig(config); config->setGroup(grp); diff --git a/kate/app/katefilelist.cpp b/kate/app/katefilelist.cpp index d2214a4d4..cda0d6b00 100644 --- a/kate/app/katefilelist.cpp +++ b/kate/app/katefilelist.cpp @@ -107,6 +107,8 @@ KateFileList::KateFileList (KateMainWindow *main, setupActions (); + connect(this,TQT_SIGNAL(moved()),this,TQT_SLOT(updateFileListLocations())); + for (uint i = 0; i < KateDocManager::self()->documents(); i++) { slotDocumentCreated (KateDocManager::self()->document(i)); @@ -228,6 +230,7 @@ void KateFileList::slotDocumentCreated (Kate::Document *doc) connect(doc,TQT_SIGNAL(modifiedOnDisc(Kate::Document *, bool, unsigned char)),this,TQT_SLOT(slotModifiedOnDisc(Kate::Document *, bool, unsigned char))); sort(); + updateFileListLocations(); updateActions (); } @@ -247,6 +250,7 @@ void KateFileList::slotDocumentDeleted (uint documentNumber) item = item->nextSibling(); } + updateFileListLocations(); updateActions (); } @@ -352,6 +356,23 @@ void KateFileList::slotViewChanged () repaintItem( m_viewHistory.at( i ) ); } + updateFileListLocations(); +} + +void KateFileList::updateFileListLocations() +{ + TQListViewItem* item = firstChild(); + int i=0; + while (item) { + if (m_sort == KateFileList::sortManual) { + ((KateFileListItem *)item)->document()->setDocumentListPosition(i); + } + else { + ((KateFileListItem *)item)->document()->setDocumentListPosition(-1); + } + item = item->itemBelow(); + i++; + } } void KateFileList::slotMenu ( TQListViewItem *item, const TQPoint &p, int /*col*/ ) @@ -437,6 +458,7 @@ void KateFileList::moveFileUp() } } } + updateFileListLocations(); } void KateFileList::moveFileDown() @@ -449,11 +471,13 @@ void KateFileList::moveFileDown() m_clickedMenuItem->moveItem(nitemabove); } } + updateFileListLocations(); } void KateFileList::updateSort () { sort (); + updateFileListLocations(); } void KateFileList::readConfig( KConfig *config, const TQString &group ) diff --git a/kate/app/katefilelist.h b/kate/app/katefilelist.h index e3504cb69..76403c1e8 100644 --- a/kate/app/katefilelist.h +++ b/kate/app/katefilelist.h @@ -126,6 +126,7 @@ class KateFileList : public KListView void slotNameChanged (Kate::Document *doc); void slotViewChanged (); void slotMenu ( TQListViewItem *item, const TQPoint &p, int col ); + void updateFileListLocations(); protected: virtual void keyPressEvent( TQKeyEvent *e ); diff --git a/kate/app/kateviewspace.cpp b/kate/app/kateviewspace.cpp index 4df741fdf..73ca6a097 100644 --- a/kate/app/kateviewspace.cpp +++ b/kate/app/kateviewspace.cpp @@ -244,7 +244,7 @@ void KateViewSpace::saveConfig ( KConfig* config, int myIndex ,const TQString& v if (currentView()) config->writeEntry( "Active View", currentView()->getDoc()->url().prettyURL() ); - // Save file list, includeing cursor position in this instance. + // Save file list, including cursor position in this instance. TQPtrListIterator<Kate::View> it(mViewList); int idx = 0; @@ -252,8 +252,9 @@ void KateViewSpace::saveConfig ( KConfig* config, int myIndex ,const TQString& v { if ( !it.current()->getDoc()->url().isEmpty() ) { + long docListPos = it.current()->getDoc()->documentListPosition(); config->setGroup( group ); - config->writeEntry( TQString("View %1").arg( idx ), it.current()->getDoc()->url().prettyURL() ); + config->writeEntry( TQString("View %1").arg( (docListPos<0)?idx:docListPos ), it.current()->getDoc()->url().prettyURL() ); // view config, group: "ViewSpace <n> url" TQString vgroup = TQString("%1 %2").arg(group).arg(it.current()->getDoc()->url().prettyURL()); diff --git a/kdesktop/lock/main.cc b/kdesktop/lock/main.cc index 7adbd5745..8bc7808ea 100644 --- a/kdesktop/lock/main.cc +++ b/kdesktop/lock/main.cc @@ -38,6 +38,15 @@ #include <X11/Xlib.h> #include <fixx11h.h> +#define OPEN_TDMCONFIG_AND_SET_GROUP \ +if( stat( KDE_CONFDIR "/tdm/tdmdistrc" , &st ) == 0) { \ + tdmconfig = new KSimpleConfig( TQString::fromLatin1( KDE_CONFDIR "/tdm/tdmdistrc" )); \ +} \ +else { \ + tdmconfig = new KSimpleConfig( TQString::fromLatin1( KDE_CONFDIR "/tdm/tdmrc" )); \ +} \ +tdmconfig->setGroup("X-*-Greeter"); + // [FIXME] Add GUI configuration checkboxes for these three settings (see kdesktoprc [ScreenSaver] UseUnmanagedLockWindows, DelaySaverStart, and UseTDESAK) bool trinity_desktop_lock_use_system_modal_dialogs = FALSE; bool trinity_desktop_lock_delay_screensaver_start = FALSE; @@ -203,13 +212,7 @@ int main( int argc, char **argv ) struct stat st; KSimpleConfig* tdmconfig; - if( stat( KDE_CONFDIR "/tdm/tdmdistrc" , &st ) == 0) { - tdmconfig = new KSimpleConfig( TQString::fromLatin1( KDE_CONFDIR "/tdm/tdmdistrc" )); - } - else { - tdmconfig = new KSimpleConfig( TQString::fromLatin1( KDE_CONFDIR "/tdm/tdmrc" )); - } - tdmconfig->setGroup("X-*-Greeter"); + OPEN_TDMCONFIG_AND_SET_GROUP trinity_desktop_lock_use_sak = tdmconfig->readBoolEntry("UseSAK", true); LockProcess process; @@ -270,7 +273,8 @@ int main( int argc, char **argv ) // Reload settings to make sure they reflect reality KDesktopSettings::self()->config()->reparseConfiguration(); - tdmconfig->reparseConfiguration(); + delete tdmconfig; + OPEN_TDMCONFIG_AND_SET_GROUP trinity_desktop_lock_use_system_modal_dialogs = !KDesktopSettings::useUnmanagedLockWindows(); trinity_desktop_lock_delay_screensaver_start = KDesktopSettings::delaySaverStart(); if (trinity_desktop_lock_use_system_modal_dialogs) { |