int main(int argc, char *argv[]) { KAboutData about("kiriki", 0, ki18n("Kiriki"), "0.2", ki18n("A Yahtzee dice game for KDE"), KAboutData::License_GPL, ki18n("© 2005-2007 Albert Astals Cid"), KLocalizedString(), "http://games.kde.org/kiriki" ); about.addAuthor(ki18n("Albert Astals Cid"), KLocalizedString(), "*****@*****.**"); KCmdLineArgs::init(argc, argv, &about); KApplication app; KGlobal::locale()->insertCatalog( QLatin1String( "libkdegames" )); app.setTopWidget(new kiriki()); return app.exec(); }
int main( int argc, char **argv ) { KAboutData aboutData( "ktimer", I18N_NOOP("KTimer"), version, description, KAboutData::License_GPL, "(c) 2001, Stefan Schimanski"); aboutData.addAuthor("Stefan Schimanski",0, "*****@*****.**"); KCmdLineArgs::init( argc, argv, &aboutData ); KApplication app; KTimerPref *timer = new KTimerPref; app.setMainWidget( timer ); app.setTopWidget( timer ); return app.exec(); }
int main ( int argc, char *argv[] ) { KAboutData aboutData ( "SUSEgreeter", 0, ki18n ( "SUSEgreeter" ), "0.1", ki18n ( "SUSEgreeter" ), KAboutData::License_GPL, ki18n ( "(c) 2001, Adrian Schroeter" ) ); aboutData.addAuthor ( ki18n ( "Adrian Schroeter" ), KLocalizedString(), "*****@*****.**" ); KCmdLineArgs::init ( argc, argv, &aboutData ); KLocale::setMainCatalog ( "SUSEgreeter" ); KApplication a; KGlobal::locale()->insertCatalog ( QString::fromLatin1 ( "kpersonalizer" ) ); // first, reset the startup from true (see desktop file in share/autostart) to false KConfig SUSEgreeterrc ( "SUSEgreeterrc" ); KConfigGroup grp = SUSEgreeterrc.group ( "General" ); bool ktip = ( grp.readEntry ( "FirstLogin113", true ) ); grp.writeEntry ( "FirstLogin113", false ); grp.sync(); SUSEgreetings greeter; a.setTopWidget ( &greeter ); greeter.adjustSize(); QDesktopWidget *dsk = kapp->desktop(); QRect scr = dsk->screenGeometry ( dsk->screenNumber ( QPoint ( 0, 0 ) ) ); QRect grt ( 0, 0, greeter.width(), greeter.height() ); grt.moveCenter ( scr.center() ); greeter.setGeometry ( grt ); greeter.show(); int ret = a.exec(); if ( ktip ) { // only run if we set this to true in the constructor. then SUSEgreeter didn't run before // set the ktiprc file entry to true. The global one is set to false for starting SUSEgreeter #if 0 KConfig ktiprc ( "ktiprc" ); KConfigGroup group = ktiprc.group ( "TipOfDay" ); group.writeEntry ( "RunOnStart", true ); ktiprc.sync(); #endif // kapp->dcopClient()->send("kicker", "kicker", "showKMenu()", ""); } return ret; }
int main(int argc, char *argv[]) { KAboutData aboutData( "kteatime", I18N_NOOP("KTeaTime"), version, description, KAboutData::License_GPL, "(c) 1998-1999, Matthias Hoelzer-Kluepfel\n(c) 2002-2003, Martin Willers"); aboutData.addAuthor("Matthias Hoelzer-Kluepfel",0, "*****@*****.**"); aboutData.addAuthor("Martin Willers", 0, "*****@*****.**"); aboutData.addCredit("Daniel Teske", I18N_NOOP("Many patches"), "*****@*****.**"); KCmdLineArgs::init( argc, argv, &aboutData ); KApplication app; TopLevel toplevel; KWin::setSystemTrayWindowFor(toplevel.winId(), 0); toplevel.show(); app.setTopWidget(&toplevel); KStartupInfo::appStarted(); return app.exec(); }
int main(int argc, char* argv[]) { ScanDialogAboutData* aboutData = new ScanDialogAboutData; aboutData->setAppName("scangui"); aboutData->setCatalogName("kipiplugin_acquireimages"); KCmdLineArgs::init(argc, argv, aboutData); KPMetadata::initializeExiv2(); KApplication app; aboutData->setProgramLogo(KIcon("scanner")); KSaneWidget* saneWidget = new KSaneWidget(0); if (!saneWidget) return -1; QString dev = saneWidget->selectDevice(0); if (dev.isEmpty()) return -1; if (!saneWidget->openDevice(dev)) { // could not open a scanner KMessageBox::sorry(0, i18n("Cannot open scanner device.")); return -1; } ScanDialog* dlg = new ScanDialog(saneWidget, app.activeWindow(), aboutData); app.setTopWidget(dlg); dlg->show(); int ret = app.exec(); KPMetadata::cleanupExiv2(); return ret; }
int main(int argc, char *argv[]) { KCmdLineArgs::init(argc, argv, "Testkhtml", "a basic web browser using the KHTML library", "1.0"); KCmdLineArgs::addCmdLineOptions(options); KApplication a; KCmdLineArgs *args = KCmdLineArgs::parsedArgs( ); if ( args->count() == 0 ) { KCmdLineArgs::usage(); ::exit( 1 ); } KHTMLFactory *fac = new KHTMLFactory(); KMainWindow *toplevel = new KMainWindow(); KHTMLPart *doc = new KHTMLPart( toplevel, 0, toplevel, 0, KHTMLPart::BrowserViewGUI ); Dummy *dummy = new Dummy( doc ); QObject::connect( doc->browserExtension(), SIGNAL( openURLRequest( const KURL &, const KParts::URLArgs & ) ), dummy, SLOT( slotOpenURL( const KURL&, const KParts::URLArgs & ) ) ); if (args->url(0).url().right(4).find(".xml", 0, false) == 0) { KParts::URLArgs ags(doc->browserExtension()->urlArgs()); ags.serviceType = "text/xml"; doc->browserExtension()->setURLArgs(ags); } doc->openURL( args->url(0) ); // DOMTreeView * dtv = new DOMTreeView(0, doc, "DomTreeView"); // dtv->show(); toplevel->setCentralWidget( doc->widget() ); toplevel->resize( 640, 800); // dtv->resize(toplevel->width()/2, toplevel->height()); QDomDocument d = doc->domDocument(); QDomElement viewMenu = d.documentElement().firstChild().childNodes().item( 2 ).toElement(); QDomElement e = d.createElement( "action" ); e.setAttribute( "name", "debugRenderTree" ); viewMenu.appendChild( e ); e = d.createElement( "action" ); e.setAttribute( "name", "debugDOMTree" ); viewMenu.appendChild( e ); QDomElement toolBar = d.documentElement().firstChild().nextSibling().toElement(); e = d.createElement( "action" ); e.setAttribute( "name", "reload" ); toolBar.insertBefore( e, toolBar.firstChild() ); e = d.createElement( "action" ); e.setAttribute( "name", "print" ); toolBar.insertBefore( e, toolBar.firstChild() ); (void)new KAction( "Reload", "reload", Qt::Key_F5, dummy, SLOT( reload() ), doc->actionCollection(), "reload" ); KAction* kprint = new KAction( "Print", "print", 0, doc->browserExtension(), SLOT( print() ), doc->actionCollection(), "print" ); kprint->setEnabled(true); toplevel->guiFactory()->addClient( doc ); doc->setJScriptEnabled(true); doc->setJavaEnabled(true); doc->setURLCursor(QCursor(Qt::PointingHandCursor)); a.setTopWidget(doc->widget()); QWidget::connect(doc, SIGNAL(setWindowCaption(const QString &)), doc->widget(), SLOT(setCaption(const QString &))); doc->widget()->show(); toplevel->show(); ((QScrollView *)doc->widget())->viewport()->show(); int ret = a.exec(); //delete doc; //delete dtv; khtml::Cache::clear(); khtml::CSSStyleSelector::clear(); khtml::RenderStyle::cleanup(); delete fac; return ret; }
int main(int argc, char *argv[]) { KCmdLineOptions options; options.add("+file", ki18n("URL to open")); KCmdLineArgs::init(argc, argv, "testkhtml", 0, ki18n("Testkhtml"), "1.0", ki18n("a basic web browser using the KHTML library")); KCmdLineArgs::addCmdLineOptions(options); KApplication a; KCmdLineArgs *args = KCmdLineArgs::parsedArgs( ); if ( args->count() == 0 ) { KCmdLineArgs::usage(); ::exit( 1 ); } new KHTMLGlobal; KXmlGuiWindow *toplevel = new KXmlGuiWindow(); KHTMLPart *doc = new KHTMLPart( toplevel, toplevel, KHTMLPart::BrowserViewGUI ); Dummy *dummy = new Dummy( doc ); QObject::connect( doc->browserExtension(), SIGNAL(openUrlRequest(KUrl,KParts::OpenUrlArguments,KParts::BrowserArguments)), dummy, SLOT(slotOpenURL(KUrl,KParts::OpenUrlArguments,KParts::BrowserArguments)) ); QObject::connect( doc, SIGNAL(completed()), dummy, SLOT(handleDone()) ); if (args->url(0).url().right(4).toLower() == ".xml") { KParts::OpenUrlArguments args(doc->arguments()); args.setMimeType("text/xml"); doc->setArguments(args); } doc->openUrl( args->url(0) ); toplevel->setCentralWidget( doc->widget() ); toplevel->resize( 800, 600); QDomDocument d = doc->domDocument(); QDomElement viewMenu = d.documentElement().firstChild().childNodes().item( 2 ).toElement(); QDomElement e = d.createElement( "action" ); e.setAttribute( "name", "debugRenderTree" ); viewMenu.appendChild( e ); e = d.createElement( "action" ); e.setAttribute( "name", "debugDOMTree" ); viewMenu.appendChild( e ); e = d.createElement( "action" ); e.setAttribute( "name", "debugDoBenchmark" ); viewMenu.appendChild( e ); QDomElement toolBar = d.documentElement().firstChild().nextSibling().toElement(); e = d.createElement( "action" ); e.setAttribute( "name", "editable" ); toolBar.insertBefore( e, toolBar.firstChild() ); e = d.createElement( "action" ); e.setAttribute( "name", "navigable" ); toolBar.insertBefore( e, toolBar.firstChild() ); e = d.createElement( "action" ); e.setAttribute( "name", "reload" ); toolBar.insertBefore( e, toolBar.firstChild() ); e = d.createElement( "action" ); e.setAttribute( "name", "print" ); toolBar.insertBefore( e, toolBar.firstChild() ); KAction *action = new KAction(KIcon("view-refresh"), "Reload", doc ); doc->actionCollection()->addAction( "reload", action ); QObject::connect(action, SIGNAL(triggered(bool)), dummy, SLOT(reload())); action->setShortcut(Qt::Key_F5); KAction *bench = new KAction( KIcon(), "Benchmark...", doc ); doc->actionCollection()->addAction( "debugDoBenchmark", bench ); QObject::connect(bench, SIGNAL(triggered(bool)), dummy, SLOT(doBenchmark())); KAction *kprint = new KAction(KIcon("document-print"), "Print", doc ); doc->actionCollection()->addAction( "print", kprint ); QObject::connect(kprint, SIGNAL(triggered(bool)), doc->browserExtension(), SLOT(print())); kprint->setEnabled(true); KToggleAction *ta = new KToggleAction( KIcon("edit-rename"), "Navigable", doc ); doc->actionCollection()->addAction( "navigable", ta ); ta->setShortcuts( KShortcut() ); ta->setChecked(doc->isCaretMode()); QWidget::connect(ta, SIGNAL(toggled(bool)), dummy, SLOT(toggleNavigable(bool))); ta = new KToggleAction( KIcon("document-properties"), "Editable", doc ); doc->actionCollection()->addAction( "editable", ta ); ta->setShortcuts( KShortcut() ); ta->setChecked(doc->isEditable()); QWidget::connect(ta, SIGNAL(toggled(bool)), dummy, SLOT(toggleEditable(bool))); toplevel->guiFactory()->addClient( doc ); doc->setJScriptEnabled(true); doc->setJavaEnabled(true); doc->setPluginsEnabled( true ); doc->setURLCursor(QCursor(Qt::PointingHandCursor)); a.setTopWidget(doc->widget()); QWidget::connect(doc, SIGNAL(setWindowCaption(QString)), doc->widget()->topLevelWidget(), SLOT(setCaption(QString))); doc->widget()->show(); toplevel->show(); doc->view()->viewport()->show(); doc->view()->widget()->show(); int ret = a.exec(); return ret; }