File tree Expand file tree Collapse file tree 1 file changed +15
-7
lines changed
Expand file tree Collapse file tree 1 file changed +15
-7
lines changed Original file line number Diff line number Diff line change 22using KeePassLib ;
33using KeePassLib . Collections ;
44using System . Windows . Forms ;
5+ using System ;
56
67namespace KeepassPinentry
78{
@@ -20,13 +21,20 @@ public PwEntry Get(string text)
2021 SearchString = text
2122 } ;
2223
23- var list = new PwObjectList < PwEntry > ( ) ;
24- Host . Database . RootGroup . SearchEntries ( p , list ) ;
25-
26- var e = list . GetAt ( 0 ) ; // TODO(djherbis): might throw
27- var title = e . Strings . ReadSafe ( PwDefs . TitleField ) ;
28- ShowBalloonNotification ( $ "Entry { title } was read.") ;
29- return e ;
24+ var databases = Host . MainWindow . DocumentManager . GetOpenDatabases ( ) ;
25+ foreach ( var database in databases )
26+ {
27+ var list = new PwObjectList < PwEntry > ( ) ;
28+ database . RootGroup . SearchEntries ( p , list ) ;
29+ if ( list . UCount > 0 )
30+ {
31+ var e = list . GetAt ( 0 ) ;
32+ var title = e . Strings . ReadSafe ( PwDefs . TitleField ) ;
33+ ShowBalloonNotification ( $ "Entry { title } was read.") ;
34+ return e ;
35+ }
36+ }
37+ throw new Exception ( "No " + text + " entry found!" ) ;
3038 }
3139
3240 public void ShowBalloonNotification ( string aMessage )
You can’t perform that action at this time.
0 commit comments