Guest User

Untitled

a guest
Jul 23rd, 2018
89
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.83 KB | None | 0 0
  1. #include <KApplication>
  2. #include <KAboutData>
  3. #include <KCmdLineArgs>
  4. #include <KUrl> //new
  5.  
  6. #include "mainwindow.h"
  7.  
  8. int main (int argc, char *argv[])
  9. {
  10. KAboutData aboutData( "tutorial5", "tutorial5",
  11. ki18n("Tutorial 5"), "1.0",
  12. ki18n("A simple text area which can load and save."),
  13. KAboutData::License_GPL,
  14. ki18n("Copyright (c) 2007 Developer") );
  15. KCmdLineArgs::init( argc, argv, &aboutData );
  16.  
  17. KCmdLineOptions options; //new
  18. options.add("+[file]", ki18n("Document to open")); //new
  19. KCmdLineArgs::addCmdLineOptions(options); //new
  20.  
  21. KApplication app;
  22.  
  23. MainWindow* window = new MainWindow();
  24. window->show();
  25.  
  26. KCmdLineArgs *args = KCmdLineArgs::parsedArgs(); //new
  27. if(args->count() == 1) //new
  28. {
  29. window->openFile(args->url(0).url()); //new
  30. }
  31.  
  32. return app.exec();
  33. }
Add Comment
Please, Sign In to add comment