Skip to content
Projeler
Gruplar
Parçacıklar
Yardım
Yükleniyor...
Oturum aç / Kaydol
Gezinmeyi değiştir
C
core
Proje
Proje
Ayrıntılar
Etkinlik
Cycle Analytics
Depo (repository)
Depo (repository)
Dosyalar
Kayıtlar (commit)
Dallar (branch)
Etiketler
Katkıda bulunanlar
Grafik
Karşılaştır
Grafikler
Konular (issue)
0
Konular (issue)
0
Liste
Pano
Etiketler
Kilometre Taşları
Birleştirme (merge) Talepleri
0
Birleştirme (merge) Talepleri
0
CI / CD
CI / CD
İş akışları (pipeline)
İşler
Zamanlamalar
Grafikler
Paketler
Paketler
Wiki
Wiki
Parçacıklar
Parçacıklar
Üyeler
Üyeler
Collapse sidebar
Close sidebar
Etkinlik
Grafik
Grafikler
Yeni bir konu (issue) oluştur
İşler
Kayıtlar (commit)
Konu (issue) Panoları
Kenar çubuğunu aç
LibreOffice
core
Commits
978ba69d
Kaydet (Commit)
978ba69d
authored
Nis 26, 2014
tarafından
Jan Holesovsky
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Eposta Yamaları
Sade Fark
recent documents: Add possibility to remove individual documents.
Change-Id: Icf059ff9a911592ab09fc385aadbec9be8ed664a
üst
e6ac6cbc
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
79 additions
and
5 deletions
+79
-5
historyoptions.hxx
include/unotools/historyoptions.hxx
+6
-5
historyoptions.cxx
unotools/source/config/historyoptions.cxx
+73
-0
No files found.
include/unotools/historyoptions.hxx
Dosyayı görüntüle @
978ba69d
...
...
@@ -82,12 +82,9 @@ public:
*/
::
com
::
sun
::
star
::
uno
::
Sequence
<
::
com
::
sun
::
star
::
uno
::
Sequence
<
::
com
::
sun
::
star
::
beans
::
PropertyValue
>
>
GetList
(
EHistoryType
eHistory
)
const
;
/** Append a new item to
specified list
/** Append a new item to
the specified list.
You can append items to a list only - removing isn't allowed for a special item.
The oldest entry is deleted automatically if max size arrived or you can call Clear() ...
It exist two different overload methods to do this.
One for user which have an complete history item and another one for uncompletly data sets!
The oldest entry is deleted automatically when the size reaches the maximum.
@param eHistory select right history.
@param sURL URL to save in history
...
...
@@ -99,6 +96,10 @@ public:
const
OUString
&
sURL
,
const
OUString
&
sFilter
,
const
OUString
&
sTitle
,
const
OUString
&
sPassword
,
const
OUString
&
sThumbnail
);
/** Delete item from the specified list.
*/
void
DeleteItem
(
EHistoryType
eHistory
,
const
OUString
&
sURL
);
private
:
/* Attention
...
...
unotools/source/config/historyoptions.cxx
Dosyayı görüntüle @
978ba69d
...
...
@@ -89,6 +89,8 @@ public:
const
OUString
&
sURL
,
const
OUString
&
sFilter
,
const
OUString
&
sTitle
,
const
OUString
&
sPassword
,
const
OUString
&
sThumbnail
);
void
DeleteItem
(
EHistoryType
eHistory
,
const
OUString
&
sURL
);
private
:
/// Return the appropriate list of recent documents (based on eHistory).
uno
::
Reference
<
container
::
XNameAccess
>
GetListAccess
(
EHistoryType
eHistory
)
const
;
...
...
@@ -473,6 +475,70 @@ void SvtHistoryOptions_Impl::AppendItem(EHistoryType eHistory,
}
}
void
SvtHistoryOptions_Impl
::
DeleteItem
(
EHistoryType
eHistory
,
const
OUString
&
sURL
)
{
uno
::
Reference
<
container
::
XNameAccess
>
xListAccess
(
GetListAccess
(
eHistory
));
if
(
!
xListAccess
.
is
())
return
;
uno
::
Reference
<
container
::
XNameContainer
>
xItemList
;
uno
::
Reference
<
container
::
XNameContainer
>
xOrderList
;
uno
::
Reference
<
beans
::
XPropertySet
>
xSet
;
try
{
xListAccess
->
getByName
(
s_sItemList
)
>>=
xItemList
;
xListAccess
->
getByName
(
s_sOrderList
)
>>=
xOrderList
;
sal_Int32
nLength
=
xOrderList
->
getElementNames
().
getLength
();
// if it does not exist, nothing to do
if
(
!
xItemList
->
hasByName
(
sURL
))
return
;
// it's the last one, just clear the lists
if
(
nLength
==
1
)
{
Clear
(
eHistory
);
return
;
}
// find it in the OrderList
sal_Int32
nFromWhere
=
0
;
for
(;
nFromWhere
<
nLength
-
1
;
++
nFromWhere
)
{
OUString
aItem
;
xOrderList
->
getByName
(
OUString
::
number
(
nFromWhere
))
>>=
xSet
;
xSet
->
getPropertyValue
(
s_sHistoryItemRef
)
>>=
aItem
;
if
(
aItem
==
sURL
)
break
;
}
// and shift the rest of the items in OrderList accordingly
for
(
sal_Int32
i
=
nFromWhere
;
i
<
nLength
-
1
;
++
i
)
{
uno
::
Reference
<
beans
::
XPropertySet
>
xPrevSet
;
uno
::
Reference
<
beans
::
XPropertySet
>
xNextSet
;
xOrderList
->
getByName
(
OUString
::
number
(
i
))
>>=
xPrevSet
;
xOrderList
->
getByName
(
OUString
::
number
(
i
+
1
))
>>=
xNextSet
;
OUString
sTemp
;
xNextSet
->
getPropertyValue
(
s_sHistoryItemRef
)
>>=
sTemp
;
xPrevSet
->
setPropertyValue
(
s_sHistoryItemRef
,
uno
::
makeAny
(
sTemp
));
}
xOrderList
->
removeByName
(
OUString
::
number
(
nLength
-
1
));
// and finally remove it from the ItemList
xItemList
->
removeByName
(
sURL
);
::
comphelper
::
ConfigurationHelper
::
flush
(
m_xCfg
);
}
catch
(
const
uno
::
Exception
&
ex
)
{
SAL_WARN
(
"unotools.config"
,
"Caught unexpected: "
<<
ex
.
Message
);
}
}
// initialize static member
// DON'T DO IT IN YOUR HEADER!
// see definition for further information
...
...
@@ -544,4 +610,11 @@ void SvtHistoryOptions::AppendItem(EHistoryType eHistory,
m_pDataContainer
->
AppendItem
(
eHistory
,
sURL
,
sFilter
,
sTitle
,
sPassword
,
sThumbnail
);
}
void
SvtHistoryOptions
::
DeleteItem
(
EHistoryType
eHistory
,
const
OUString
&
sURL
)
{
MutexGuard
aGuard
(
theHistoryOptionsMutex
::
get
());
m_pDataContainer
->
DeleteItem
(
eHistory
,
sURL
);
}
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment