Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <KApplication>
- #include <KAboutData>
- #include <KCmdLineArgs>
- #include <KUrl> //new
- #include "mainwindow.h"
- int main (int argc, char *argv[])
- {
- KAboutData aboutData( "tutorial5", "tutorial5",
- ki18n("Tutorial 5"), "1.0",
- ki18n("A simple text area which can load and save."),
- KAboutData::License_GPL,
- ki18n("Copyright (c) 2007 Developer") );
- KCmdLineArgs::init( argc, argv, &aboutData );
- KCmdLineOptions options; //new
- options.add("+[file]", ki18n("Document to open")); //new
- KCmdLineArgs::addCmdLineOptions(options); //new
- KApplication app;
- MainWindow* window = new MainWindow();
- window->show();
- KCmdLineArgs *args = KCmdLineArgs::parsedArgs(); //new
- if(args->count() == 1) //new
- {
- window->openFile(args->url(0).url()); //new
- }
- return app.exec();
- }
Add Comment
Please, Sign In to add comment