summaryrefslogtreecommitdiff
path: root/basic
diff options
context:
space:
mode:
authorGregor Hartmann <gh@openoffice.org>2002-11-12 10:33:28 +0000
committerGregor Hartmann <gh@openoffice.org>2002-11-12 10:33:28 +0000
commit3eadbf4f083b03015023a5843b3c12bb41b64408 (patch)
tree25ea8ae42bb4bd8434288de57a5c17b02ddcb4af /basic
parentd0e945790494e61f557420d6a44c03b323bd01e6 (diff)
#97187#Implemented functionality. no UI yet
Diffstat (limited to 'basic')
-rw-r--r--basic/source/app/app.cxx30
1 files changed, 22 insertions, 8 deletions
diff --git a/basic/source/app/app.cxx b/basic/source/app/app.cxx
index de985be5abd1..55715e4d95ff 100644
--- a/basic/source/app/app.cxx
+++ b/basic/source/app/app.cxx
@@ -2,9 +2,9 @@
*
* $RCSfile: app.cxx,v $
*
- * $Revision: 1.40 $
+ * $Revision: 1.41 $
*
- * last change: $Author: gh $ $Date: 2002-11-08 13:55:55 $
+ * last change: $Author: gh $ $Date: 2002-11-12 11:33:28 $
*
* The Contents of this file are made available subject to the terms of
* either of the following licenses
@@ -1124,22 +1124,34 @@ void BasicFrame::AddToLRU(String const& aFile)
PopupMenu *pPopup = GetMenuBar()->GetPopupMenu(RID_APPFILE);
aConfig.SetGroup("LRU");
+ USHORT nMaxLRU = aConfig.ReadKey("MaxLRU","4").ToInt32();
DirEntry aFileEntry( aFile );
- USHORT i,nLastMove = 4;
+ USHORT i,nLastMove = nMaxLRU;
- for ( i = 1 ; i<4 && nLastMove == 4 ; i++ )
+ for ( i = 1 ; i<nMaxLRU && nLastMove == nMaxLRU ; i++ )
{
if ( DirEntry( UniString( aConfig.ReadKey(LRUNr(i),""), RTL_TEXTENCODING_UTF8 ) ) == aFileEntry )
nLastMove = i;
}
+ if ( pPopup->GetItemPos( IDM_FILE_LRU1 ) == MENU_ITEM_NOTFOUND )
+ pPopup->InsertSeparator();
for ( i = nLastMove ; i>1 ; i-- )
{
- aConfig.WriteKey(LRUNr(i), aConfig.ReadKey(LRUNr(i-1),""));
- pPopup->SetItemText(IDM_FILE_LRU1 + i-1,FILENAME2MENU( i, pPopup->GetItemText(IDM_FILE_LRU1 + i-1-1).MENU2FILENAME ));
+ if ( aConfig.ReadKey(LRUNr(i-1),"").Len() )
+ {
+ aConfig.WriteKey(LRUNr(i), aConfig.ReadKey(LRUNr(i-1),""));
+ if ( pPopup->GetItemPos( IDM_FILE_LRU1 + i-1 ) == MENU_ITEM_NOTFOUND )
+ pPopup->InsertItem(IDM_FILE_LRU1 + i-1, FILENAME2MENU( i, pPopup->GetItemText(IDM_FILE_LRU1 + i-1-1).MENU2FILENAME ));
+ else
+ pPopup->SetItemText(IDM_FILE_LRU1 + i-1,FILENAME2MENU( i, pPopup->GetItemText(IDM_FILE_LRU1 + i-1-1).MENU2FILENAME ));
+ }
}
aConfig.WriteKey(LRUNr(1), ByteString( aFile, RTL_TEXTENCODING_UTF8 ) );
- pPopup->SetItemText(IDM_FILE_LRU1,FILENAME2MENU( 1, aFile) );
+ if ( pPopup->GetItemPos( IDM_FILE_LRU1 + i-1 ) == MENU_ITEM_NOTFOUND )
+ pPopup->InsertItem(IDM_FILE_LRU1,FILENAME2MENU( 1, aFile));
+ else
+ pPopup->SetItemText(IDM_FILE_LRU1,FILENAME2MENU( 1, aFile));
}
void BasicFrame::LoadLRU()
@@ -1149,8 +1161,10 @@ void BasicFrame::LoadLRU()
BOOL bAddSep = TRUE;
aConfig.SetGroup("LRU");
+ USHORT nMaxLRU = aConfig.ReadKey("MaxLRU","4").ToInt32();
- for (int i=1; i<=4 && pPopup!=NULL; i++)
+ int i;
+ for ( i = 1; i <= nMaxLRU && pPopup != NULL; i++)
{
String aFile = UniString( aConfig.ReadKey(LRUNr(i)), RTL_TEXTENCODING_UTF8 );