set sane start dir for PKCS#11 lib selection

This commit is contained in:
Christian Hohnstaedt 2010-08-14 11:01:31 +02:00
parent 6902307c32
commit 9924d39668
4 changed files with 20 additions and 1 deletions

View File

@ -111,6 +111,22 @@ QString getHomeDir()
return hd;
}
QString getLibDir()
{
QString hd;
#ifdef WIN32
LPITEMIDLIST pidl = NULL;
TCHAR buf[255] = "";
if (SUCCEEDED(SHGetSpecialFolderLocation(NULL, CSIDL_SYSTEM, &pidl))) {
SHGetPathFromIDList(pidl, buf);
}
hd = buf;
#else
hd = QString("/usr/lib");
#endif
return hd;
}
QString getDocDir()
{
#if defined(WIN32) || defined (Q_WS_MAC)

View File

@ -18,6 +18,7 @@ class Validity;
QPixmap *loadImg(const char *name);
QString getPrefix();
QString getHomeDir();
QString getLibDir();
QString getDocDir();
QString getUserSettingsDir();
QString getFullFilename(const QString &filename, const QString &selectedFilter);

View File

@ -13,5 +13,6 @@ Makefile.qt: macdeployqt.pro
clean:
rm -f *.o Makefile.qt macdeployqt
distclean: clean
include $(TOPDIR)/Local.mak

View File

@ -5,6 +5,7 @@
* All rights reserved.
*/
#include "lib/func.h"
#include "Options.h"
#include "lib/pki_scard.h"
#include <openssl/objects.h>
@ -81,7 +82,7 @@ void Options::on_addButton_clicked(void)
QString fname, status;
fname = QFileDialog::getOpenFileName(this, l.caption,
QString(), l.filter);
getLibDir(), l.filter);
if (fname.isEmpty() || pkcs11::get_lib(fname))
return;