mirror of
https://bitbucket.org/smil3y/kdelibs.git
synced 2025-02-24 10:52:49 +00:00
29 lines
859 B
C++
29 lines
859 B
C++
![]() |
#include <kapplication.h>
|
||
|
#include <kdirselectdialog.h>
|
||
|
#include <kmessagebox.h>
|
||
|
#include <kcmdlineargs.h>
|
||
|
#include <kurl.h>
|
||
|
|
||
|
|
||
|
int main( int argc, char **argv )
|
||
|
{
|
||
|
KCmdLineArgs::init(argc, argv, "kdirselectdialogtest", 0, ki18n("kdirselectdialogtest"), "0", ki18n("test app"));
|
||
|
|
||
|
KCmdLineOptions opt;
|
||
|
opt.add("+[startDir]", ki18n("Directory to start in"), QByteArray());
|
||
|
|
||
|
KCmdLineArgs::addCmdLineOptions(opt);
|
||
|
|
||
|
KApplication app;
|
||
|
app.setQuitOnLastWindowClosed(false);
|
||
|
|
||
|
KUrl u = KDirSelectDialog::selectDirectory( KCmdLineArgs::parsedArgs()->count() >= 1 ?
|
||
|
KCmdLineArgs::parsedArgs()->arg(0) : QString() );
|
||
|
if ( u.isValid() )
|
||
|
KMessageBox::information( 0L,
|
||
|
QString("You selected the url: %1")
|
||
|
.arg( u.prettyUrl() ), "Selected URL" );
|
||
|
|
||
|
return 0;
|
||
|
}
|