Пример #1
0
void Amor::slotMouseClicked(const QPoint &pos)
{
    bool restartTimer = mTimer->isActive();

    // Stop the animation while the menu is open.
    if( restartTimer ) {
        mTimer->stop();
    }

    if( !mMenu ) {
        KHelpMenu* help = new KHelpMenu( 0, KGlobal::mainComponent().aboutData(), false );
        KMenu* helpMenu = help->menu();
#ifdef __GNUC__
#warning the following is kinda dirty and should be done by KHelpMenu::menu() I think. (hermier)
#endif
        helpMenu->setIcon( SmallIcon( QLatin1String( "help-contents" ) ) );
        helpMenu->setTitle( i18nc( "@action:inmenu Amor", "&Help" ) );

        mMenu = new KMenu( 0 );
        mMenu->addTitle( QLatin1String( "Amor" ) ); // I really don't want this i18n'ed
        mMenu->addAction( SmallIcon( QLatin1String ("configure" ) ), i18nc( "@action:inmenu Amor", "&Configure..." ), this, SLOT(slotConfigure()) );
        mMenu->addSeparator();
        mMenu->addMenu( helpMenu );
        mMenu->addAction( SmallIcon( QLatin1String( "application-exit" ) ), i18nc( "@action:inmenu Amor", "&Quit" ), kapp, SLOT(quit()) );
    }

    mMenu->exec( pos );

    if( restartTimer ) {
        mTimer->setSingleShot( true );
        mTimer->start( 1000 );
    }
}
Пример #2
0
NotesAgentSettingsDialog::NotesAgentSettingsDialog(QWidget *parent)
    : QDialog(parent)
{
    setWindowTitle(i18n("Configure Notes Agent"));
    setWindowIcon(QIcon::fromTheme(QStringLiteral("knotes")));
    QDialogButtonBox *buttonBox = new QDialogButtonBox(QDialogButtonBox::Ok | QDialogButtonBox::Cancel | QDialogButtonBox::Help, this);
    QVBoxLayout *mainLayout = new QVBoxLayout;
    setLayout(mainLayout);
    QPushButton *okButton = buttonBox->button(QDialogButtonBox::Ok);
    okButton->setDefault(true);
    okButton->setShortcut(Qt::CTRL | Qt::Key_Return);
    connect(buttonBox, &QDialogButtonBox::rejected, this, &NotesAgentSettingsDialog::reject);
    connect(okButton, &QPushButton::clicked, this, &NotesAgentSettingsDialog::slotOkClicked);

    setModal(true);
    QWidget *mainWidget = new QWidget(this);
    QHBoxLayout *lay = new QHBoxLayout(mainWidget);

    QTabWidget *tab = new QTabWidget;
    lay->addWidget(tab);

    mNotify = new KNotifyConfigWidget(this);
    mNotify->setApplication(QStringLiteral("akonadi_notes_agent"));
    tab->addTab(mNotify, i18n("Notify"));

    mNetworkConfig = new NoteShared::NoteNetworkConfigWidget(this);
    tab->addTab(mNetworkConfig, i18n("Network"));
    mNetworkConfig->load();

    mainLayout->addWidget(mainWidget);
    mainLayout->addWidget(buttonBox);
    readConfig();

    KAboutData aboutData = KAboutData(
                               QStringLiteral("notesagent"),
                               i18n("Notes Agent"),
                               QStringLiteral(KNOTES_VERSION),
                               i18n("Notes Agent."),
                               KAboutLicense::GPL_V2,
                               i18n("Copyright (C) 2013-2016 Laurent Montel"));

    aboutData.addAuthor(i18n("Laurent Montel"),
                        i18n("Maintainer"), QStringLiteral("*****@*****.**"));

    QApplication::setWindowIcon(QIcon::fromTheme(QStringLiteral("knotes")));
    aboutData.setTranslator(i18nc("NAME OF TRANSLATORS", "Your names"),
                            i18nc("EMAIL OF TRANSLATORS", "Your emails"));

    KHelpMenu *helpMenu = new KHelpMenu(this, aboutData, true);
    //Initialize menu
    QMenu *menu = helpMenu->menu();
    helpMenu->action(KHelpMenu::menuAboutApp)->setIcon(QIcon::fromTheme(QStringLiteral("knotes")));
    buttonBox->button(QDialogButtonBox::Help)->setMenu(menu);
}
void setupHelpButton(KDialog* dialog, KAboutData* aboutData)
{
    QObject::disconnect(dialog, SIGNAL(helpClicked()),
                        dialog, SLOT(slotHelp()));

    KHelpMenu* helpMenu = new KHelpMenu(dialog, aboutData, false);
    KMenu* menu         = helpMenu->menu();
    menu->removeAction(menu->actions().first());

    QAction* openHandbookAction = new QAction(i18n("Handbook"), dialog);

    QObject::connect(openHandbookAction, SIGNAL(triggered(bool)),
                     dialog, SLOT(slotHelp()));

    menu->insertAction(menu->actions().first(), openHandbookAction);
    dialog->button(KDialog::Help)->setMenu(menu);
}
Пример #4
0
SendLaterConfigureDialog::SendLaterConfigureDialog(QWidget *parent)
    : QDialog(parent)
{
    setWindowTitle(i18n("Configure"));
    setWindowIcon(QIcon::fromTheme(QStringLiteral("kmail")));
    QDialogButtonBox *buttonBox = new QDialogButtonBox(QDialogButtonBox::Ok | QDialogButtonBox::Cancel | QDialogButtonBox::Help);
    QVBoxLayout *mainLayout = new QVBoxLayout(this);
    setLayout(mainLayout);
    QPushButton *okButton = buttonBox->button(QDialogButtonBox::Ok);
    okButton->setDefault(true);
    okButton->setShortcut(Qt::CTRL | Qt::Key_Return);
    connect(buttonBox, &QDialogButtonBox::rejected, this, &SendLaterConfigureDialog::reject);

    mWidget = new SendLaterWidget(this);
    mWidget->setObjectName(QStringLiteral("sendlaterwidget"));
    connect(mWidget, &SendLaterWidget::sendNow, this, &SendLaterConfigureDialog::sendNow);
    mainLayout->addWidget(mWidget);
    mainLayout->addWidget(buttonBox);
    connect(okButton, &QPushButton::clicked, this, &SendLaterConfigureDialog::slotSave);

    readConfig();

    KAboutData aboutData = KAboutData(
                               QStringLiteral("sendlateragent"),
                               i18n("Send Later Agent"),
                               QStringLiteral(KDEPIM_VERSION),
                               i18n("Send emails later agent."),
                               KAboutLicense::GPL_V2,
                               i18n("Copyright (C) 2013-2016 Laurent Montel"));

    aboutData.addAuthor(i18n("Laurent Montel"),
                        i18n("Maintainer"), QStringLiteral("*****@*****.**"));

    QApplication::setWindowIcon(QIcon::fromTheme(QStringLiteral("kmail")));
    aboutData.setTranslator(i18nc("NAME OF TRANSLATORS", "Your names"),
                            i18nc("EMAIL OF TRANSLATORS", "Your emails"));

    KHelpMenu *helpMenu = new KHelpMenu(this, aboutData, true);
    //Initialize menu
    QMenu *menu = helpMenu->menu();
    helpMenu->action(KHelpMenu::menuAboutApp)->setIcon(QIcon::fromTheme(QStringLiteral("kmail")));
    buttonBox->button(QDialogButtonBox::Help)->setMenu(menu);
}
Пример #5
0
void KRenameWindow::setupGui()
{
    m_buttons->clear();

    m_guiMode    = &tAdvancedMode;

    m_buttonFinish = new QPushButton(QIcon::fromTheme(QStringLiteral("dialog-ok")),    i18n("&Finish"));

    m_buttons->setStandardButtons(QDialogButtonBox::Help | QDialogButtonBox::Close);
    m_buttons->addButton(m_buttonFinish, QDialogButtonBox::AcceptRole);
    m_buttonClose = m_buttons->button(QDialogButtonBox::Close);
    m_buttonClose->setShortcut(QKeySequence(QKeySequence::Quit));

    KHelpMenu *helpMenu = new KHelpMenu(this);
    m_buttons->button(QDialogButtonBox::Help)->setMenu(helpMenu->menu());

    setupSlots();
    slotEnableControls();
}
CalWizard::CalWizard(KIPI::Interface* interface, QWidget* parent)
    : KAssistantDialog(parent),
      interface_(interface)
{
    setMaximumSize(800, 600);
    cSettings_   = CalSettings::instance(this);

    // ---------------------------------------------------------------

    wTemplate_   = new CalTemplate(interface, this);
    addPage(wTemplate_, i18n("Create Template for Calendar"));

    // ---------------------------------------------------------------

    wEvents_     = new QWidget(this);
    calEventsUI.setupUi(wEvents_);
    addPage(wEvents_, i18n("Choose events to show on the Calendar"));

    // ---------------------------------------------------------------

    wPrintLabel_ = new QLabel(this);
    wPrintLabel_->setIndent(20);
    wPrintLabel_->setWordWrap(true);

    wPrintPage_ = addPage(wPrintLabel_, i18n("Print"));

    // ---------------------------------------------------------------

    wFinish_     = new QWidget(this);
    calProgressUI.setupUi(wFinish_);
    wFinishPage_ = addPage(wFinish_, i18n("Printing"));

    // ---------------------------------------------------------------

    // About data and help button.

    m_about = new KIPIPlugins::KPAboutData(ki18n("Calendar"),
                                           0,
                                           KAboutData::License_GPL,
                                           ki18n("A Kipi plugin to create a calendar"),
                                           ki18n("(c) 2003-2005, Renchi Raju\n"
                                                 "(c) 2006 Tom Albers\n"
                                                 "(c) 2007-2008 Orgad Shaneh"));

    m_about->addAuthor(ki18n("Orgad Shaneh"), ki18n("Author and maintainer"),
                       "*****@*****.**");

    m_about->addAuthor(ki18n("Tom Albers"), ki18n("Former author and maintainer"),
                       "*****@*****.**");

    m_about->addAuthor(ki18n("Renchi Raju"), ki18n("Former author and maintainer"),
                       "renchi dot raju at gmail dot com");

    disconnect(this, SIGNAL(helpClicked()),
               this, SLOT(slotHelp()));

    KHelpMenu* helpMenu = new KHelpMenu(this, m_about, false);
    helpMenu->menu()->removeAction(helpMenu->menu()->actions().first());
    QAction* handbook   = new QAction(i18n("Handbook"), this);
    connect(handbook, SIGNAL(triggered()),
            this, SLOT(slotHelp()));
    helpMenu->menu()->insertAction(helpMenu->menu()->actions().first(), handbook);
    button(Help)->setMenu(helpMenu->menu());

    // ------------------------------------------

    printThread_ = 0;
    printer_     = 0;

    connect(this, SIGNAL(currentPageChanged(KPageWidgetItem*,KPageWidgetItem*)),
            this, SLOT(slotPageSelected(KPageWidgetItem*,KPageWidgetItem*)));

    setCaption(i18n("Create Calendar"));
}
Пример #7
0
servercontroller::servercontroller( QWidget*, const char* name )
    : KMainWindow( 0, name )
{
  we_are_exiting = false;
  m_notificationCount = 0;

  m_ncm = new nickColourMaker();

  MenuBar = menuBar();
  KWin::setIcons( winId(), kapp->icon(), kapp->miniIcon() );

  s_self = this;

  switch (ksopts->displayMode)
  {
    case KSOptions::SDI:
        displayMgr = new DisplayMgrSDI();
        break;
    case KSOptions::MDI:
        displayMgr = new DisplayMgrMDI();
        break;
  }

  sci = new scInside(this, QCString(name) + "_mainview");
  setCentralWidget(sci);

  sci->setFrameStyle(QFrame::Box | QFrame::Raised);
  ConnectionTree = sci->ConnectionTree;

  connect(ConnectionTree, SIGNAL(clicked( QListViewItem * )),
	  this, SLOT(WindowSelected(QListViewItem *)));

  setFrameBorderWidth(5);

  QPopupMenu *file = new QPopupMenu(this, QCString(name) + "_menu_file");
  KStdAction::quit(this, SLOT(endksirc()), actionCollection())->plug(file);
#ifndef NDEBUG
  file->insertItem(i18n("Dump Object Tree"), this, SLOT(dump_obj()));
  file->insertItem(i18n("Server Debug Window"), this, SLOT(server_debug()));
#endif
  MenuBar->insertItem(i18n("&File"), file);

  connections = new QPopupMenu(this, QCString(name) + "_menu_connections");

  server_id = connections->insertItem(i18n("&New Server..."), this, SLOT(new_connection()), Key_F2 );
  join_id = connections->insertItem(i18n("&Join Channel..."), this, SLOT(new_channel()), Key_F3 );
  connections->insertSeparator();
  connections->insertItem(i18n("&Do Autoconnect..."), this, SLOT(start_autoconnect_check()));
  connections->setItemEnabled(join_id, FALSE);
  MenuBar->insertItem(i18n("&Connections"), connections);

  options = new QPopupMenu(this, QCString(name) + "_menu_options");
  options->setCheckable(TRUE);

  options->insertItem(SmallIcon( "filter" ), i18n("&Filter Rule Editor..."),
		      this, SLOT(filter_rule_editor()));
  options->insertSeparator();
  KStdAction::configureNotifications(this, SLOT(notification_prefs()), actionCollection())->plug(options);

  KStdAction::preferences(this, SLOT(general_prefs()), actionCollection())->plug(options);

  MenuBar->insertItem(i18n("&Settings"), options);

  KHelpMenu *help = new KHelpMenu( this, kapp->aboutData() );
  MenuBar->insertItem( KStdGuiItem::help().text(), help->menu() );

  m_kga = new KGlobalAccel(this, "globalAccess");
  m_kga->insert("New Server", i18n("New Server"),
		i18n("This action allows you to open a new server more easily "
		     "when in docked mode, since you don't need to click on the "
		     "dock icon."),
		ALT+CTRL+Key_C, KKey::QtWIN+CTRL+Key_C, this,
		SLOT(new_connection()));

  open_toplevels = 0;

  pic_server = UserIcon("server");
  pic_gf = UserIcon("ksirc_a");
  pic_run = UserIcon("mini-run");
  pic_ppl = UserIcon("channels");
  pic_icon = UserIcon("ksirc_b");

  setCaption( i18n("Server Control") );
  KWin::setIcons(winId(), pic_icon, pic_server);

  resize( 450,200 );

  dockWidget = new dockServerController(this, 0x0, "servercontroller_dock");
  KWin::setSystemTrayWindowFor( dockWidget->winId(), winId() );

  m_kga->readSettings();
  m_kga->updateConnections();

  checkDocking();
}
Пример #8
0
KSnapshot::KSnapshot(QWidget *parent, const char *name, bool grabCurrent)
  : DCOPObject("interface"), 
    KDialogBase(parent, name, true, QString::null, Help|User1, User1, 
    true, KStdGuiItem::quit() )
{
    grabber = new QWidget( 0, 0, WStyle_Customize | WX11BypassWM );
    grabber->move( -1000, -1000 );
    grabber->installEventFilter( this );

    KStartupInfo::appStarted();

    QVBox *vbox = makeVBoxMainWidget();
    mainWidget = new KSnapshotWidget( vbox, "mainWidget" );

    connect(mainWidget, SIGNAL(startImageDrag()), SLOT(slotDragSnapshot()));

    connect( mainWidget, SIGNAL( newClicked() ), SLOT( slotGrab() ) );
    connect( mainWidget, SIGNAL( saveClicked() ), SLOT( slotSaveAs() ) );
    connect( mainWidget, SIGNAL( printClicked() ), SLOT( slotPrint() ) );
    connect( mainWidget, SIGNAL( copyClicked() ), SLOT( slotCopy() ) );

    grabber->show();
    grabber->grabMouse( waitCursor );

    if ( !grabCurrent )
	snapshot = QPixmap::grabWindow( qt_xrootwin() );
    else {
	mainWidget->setMode( WindowUnderCursor );
	mainWidget->setIncludeDecorations( true );
	performGrab();
    }

    updatePreview();
    grabber->releaseMouse();
    grabber->hide();

    KConfig *conf=KGlobal::config();
    conf->setGroup("GENERAL");
    mainWidget->setDelay(conf->readNumEntry("delay",0));
    mainWidget->setMode( conf->readNumEntry( "mode", 0 ) );
    mainWidget->setIncludeDecorations(conf->readBoolEntry("includeDecorations",true));
    filename = KURL::fromPathOrURL( conf->readPathEntry( "filename", QDir::currentDirPath()+"/"+i18n("snapshot")+"1.png" ));

    // Make sure the name is not already being used
    while(KIO::NetAccess::exists( filename, false, this )) {
	autoincFilename();
    }

    connect( &grabTimer, SIGNAL( timeout() ), this, SLOT(  grabTimerDone() ) );
    connect( &updateTimer, SIGNAL( timeout() ), this, SLOT(  updatePreview() ) );
    QTimer::singleShot( 0, this, SLOT( updateCaption() ) );

    KHelpMenu *helpMenu = new KHelpMenu(this, KGlobal::instance()->aboutData(), false);

    QPushButton *helpButton = actionButton( Help );
    helpButton->setPopup(helpMenu->menu());

    KAccel* accel = new KAccel(this);
    accel->insert(KStdAccel::Quit, kapp, SLOT(quit()));
    accel->insert( "QuickSave", i18n("Quick Save Snapshot &As..."),
		   i18n("Save the snapshot to the file specified by the user without showing the file dialog."),
		   CTRL+SHIFT+Key_S, this, SLOT(slotSave()));
    accel->insert(KStdAccel::Save, this, SLOT(slotSaveAs()));
//    accel->insert(KShortcut(CTRL+Key_A), this, SLOT(slotSaveAs()));
    accel->insert( "SaveAs", i18n("Save Snapshot &As..."),
		   i18n("Save the snapshot to the file specified by the user."),
		   CTRL+Key_A, this, SLOT(slotSaveAs()));
    accel->insert(KStdAccel::Print, this, SLOT(slotPrint()));
    accel->insert(KStdAccel::New, this, SLOT(slotGrab()));
    accel->insert(KStdAccel::Copy, this, SLOT(slotCopy()));

    accel->insert( "Quit2", Key_Q, this, SLOT(slotSave()));
    accel->insert( "Save2", Key_S, this, SLOT(slotSaveAs()));
    accel->insert( "Print2", Key_P, this, SLOT(slotPrint()));
    accel->insert( "New2", Key_N, this, SLOT(slotGrab()));
    accel->insert( "New3", Key_Space, this, SLOT(slotGrab()));

    setEscapeButton( User1 );
    connect( this, SIGNAL( user1Clicked() ), SLOT( reject() ) );

    mainWidget->btnNew->setFocus();
}
Пример #9
0
  WSWindow::WSWindow(KIPI::Interface* interface,
		     QWidget *parent) :
    KDialogBase(parent, 0, false, i18n("Web Service Export"),
		Help|Close, Close, false),
    interface(interface), service(0)
  {

     about = new KIPIPlugins::KPAboutData(I18N_NOOP("Web Service Export"),
                                            NULL,
                                            KAboutData::License_GPL,
                                            I18N_NOOP("Kipi plugin to export to a web service"),
                                            "(c) 2007, Pontus Freyhult");

     about->addAuthor("Pontus Freyhult", I18N_NOOP("Author and maintainer"),
                      "*****@*****.**");

     helpButton = actionButton( Help );
     KHelpMenu* helpMenu = new KHelpMenu(this, about, false);
     helpButton->setPopup( helpMenu->menu() );

     widget = new WSWidget( this );
     setMainWidget( widget );
     //     widget->setMinimumSize( widget->minimumSizeHint() );
     widget->setMinimumSize( 800,500);


     if( !interface->hasFeature(KIPI::ImagesHasComments) &&
	 !interface->hasFeature(KIPI::AlbumsHaveComments))
       {
	 widget->privateMode->setChecked(true);
	 widget->privateMode->setEnabled(false);
       }


     connect(  dynamic_cast< QObject* >( widget->serviceSelector),
	       SIGNAL( activated(int) ), 
	       SLOT( slotServiceChanged(int)));

     connect(  dynamic_cast< QObject* >( widget->uploadButton),
	       SIGNAL( clicked() ), 
	       SLOT( slotUploadButton()));



     connect(  dynamic_cast< QObject* >( widget->addToAlbum),
	       SIGNAL( clicked() ), 
	       SLOT( slotAddToAlbum()));


     connect(  dynamic_cast< QObject* >( widget->uploadAlbums),
	       SIGNAL( clicked() ), 
	       SLOT( slotUploadAlbums()));


     connect(  dynamic_cast< QObject* >( widget->uploadAllAlbums),
	       SIGNAL( clicked() ), 
	       SLOT( slotUploadAllAlbums()));


     connect(  dynamic_cast< QObject* >( widget->configuration),
	       SIGNAL( activated(int) ), 
	       SLOT( slotConfigurationChanged(int)));

     connect(  dynamic_cast< QObject* >( widget->category),
	       SIGNAL( activated(int) ), 
	       SLOT( slotCategoryChanged(int)));

     connect(  dynamic_cast< QObject* >( widget->subcategory),
	       SIGNAL( activated(int) ), 
	       SLOT( slotSubcategoryChanged(int)));






     connect(  interface,
	       SIGNAL( selectionChanged(bool) ), 
	       SLOT( slotRefreshUI()));




     widget->statusLed->setColor(yellow);

     KConfig config("kipirc");
     config.setGroup("WSExport Settings");


     currentService = -1;
     slotServiceChanged( config.readNumEntry("Service",0) );
     widget->serviceSelector->setCurrentItem(currentService);


  }
Пример #10
0
void MainWindow::run()
{
	// Allow the user to enable or disable debugging
	// We handle this before the other parameters, as it may affect some
	// early debug messages
        QLoggingCategory::defaultCategory()->setEnabled(QtDebugMsg, parser->isSet("debug"));

	readSettings();

	setAttribute(Qt::WA_DeleteOnClose, true);

	// menu structure

	QMenuBar *menuBar = QMainWindow::menuBar();
	collection = new KActionCollection(this);

	QMenu *menu = new QMenu(i18n("&File"), this);
	menuBar->addMenu(menu);

	QAction *action = KStandardAction::open(this, SLOT(open()), collection);
	menu->addAction(collection->addAction(QLatin1String("file_open"), action));

	action = new QAction(QIcon::fromTheme(QLatin1String("text-html"), QIcon(":text-html")),
		i18nc("@action:inmenu", "Open URL..."), collection);
	action->setShortcut(Qt::CTRL | Qt::Key_U);
	connect(action, SIGNAL(triggered(bool)), this, SLOT(openUrl()));
	menu->addAction(collection->addAction(QLatin1String("file_open_url"), action));

	actionOpenRecent = KStandardAction::openRecent(this, SLOT(openUrl(QUrl)), collection);
	actionOpenRecent->loadEntries(KSharedConfig::openConfig()->group("Recent Files"));
	menu->addAction(collection->addAction(QLatin1String("file_open_recent"), actionOpenRecent));

	menu->addSeparator();

	action = new QAction(QIcon::fromTheme(QLatin1String("media-optical-audio"), QIcon(":media-optical-audio")), i18n("Play Audio CD"), collection);
	connect(action, SIGNAL(triggered(bool)), this, SLOT(openAudioCd()));
	menu->addAction(collection->addAction(QLatin1String("file_play_audiocd"), action));

	action = new QAction(QIcon::fromTheme(QLatin1String("media-optical"), QIcon(":media-optical")), i18n("Play Video CD"), collection);
	connect(action, SIGNAL(triggered(bool)), this, SLOT(openVideoCd()));
	menu->addAction(collection->addAction(QLatin1String("file_play_videocd"), action));

	action = new QAction(QIcon::fromTheme(QLatin1String("media-optical"), QIcon(":media-optical")), i18n("Play DVD"), collection);
	connect(action, SIGNAL(triggered(bool)), this, SLOT(openDvd()));
	menu->addAction(collection->addAction(QLatin1String("file_play_dvd"), action));

	action = new QAction(QIcon::fromTheme(QLatin1String("media-optical"), QIcon(":media-optical")), i18nc("@action:inmenu", "Play DVD Folder"),
		collection);
	connect(action, SIGNAL(triggered()), this, SLOT(playDvdFolder()));
	menu->addAction(collection->addAction(QLatin1String("file_play_dvd_folder"), action));

	menu->addSeparator();

	action = KStandardAction::quit(this, SLOT(close()), collection);
	menu->addAction(collection->addAction(QLatin1String("file_quit"), action));

	QMenu *playerMenu = new QMenu(i18n("&Playback"), this);
	menuBar->addMenu(playerMenu);

	QMenu *playlistMenu = new QMenu(i18nc("menu bar", "Play&list"), this);
	menuBar->addMenu(playlistMenu);

#if HAVE_DVB == 1
	QMenu *dvbMenu = new QMenu(i18n("&Television"), this);
	menuBar->addMenu(dvbMenu);
#endif /* HAVE_DVB == 1 */

	menu = new QMenu(i18n("&Settings"), this);
	menuBar->addMenu(menu);

	action = KStandardAction::keyBindings(this, SLOT(configureKeys()), collection);
	menu->addAction(collection->addAction(QLatin1String("settings_keys"), action));

	action = KStandardAction::preferences(this, SLOT(configureKaffeine()), collection);
	menu->addAction(collection->addAction(QLatin1String("settings_kaffeine"), action));

	menuBar->addSeparator();
	KHelpMenu *helpMenu = new KHelpMenu(this, *aboutData);
	menuBar->addMenu(helpMenu->menu());

	// navigation bar - keep in sync with TabIndex enum!

	navigationBar = new QToolBar(QLatin1String("navigation_bar"));
	this->addToolBar(Qt::LeftToolBarArea, navigationBar);
	connect(navigationBar, SIGNAL(orientationChanged(Qt::Orientation)),
		this, SLOT(navigationBarOrientationChanged(Qt::Orientation)));

	tabBar = new QTabBar(navigationBar);
	tabBar->addTab(QIcon::fromTheme(QLatin1String("start-here-kde"), QIcon(":start-here-kde")), i18n("Start"));
	tabBar->addTab(QIcon::fromTheme(QLatin1String("kaffeine"), QIcon(":kaffeine")), i18n("Playback"));
	tabBar->addTab(QIcon::fromTheme(QLatin1String("view-media-playlist"), QIcon(":view-media-playlist")), i18n("Playlist"));
#if HAVE_DVB == 1
	tabBar->addTab(QIcon::fromTheme(QLatin1String("video-television"), QIcon(":video-television")), i18n("Television"));
#endif /* HAVE_DVB == 1 */
	tabBar->setShape(QTabBar::RoundedWest);
	tabBar->setSizePolicy(QSizePolicy::Preferred, QSizePolicy::Preferred);
	connect(tabBar, SIGNAL(currentChanged(int)), this, SLOT(activateTab(int)));
	navigationBar->addWidget(tabBar);

	// control bar

	controlBar = new QToolBar(QLatin1String("control_bar"));
	this->addToolBar(Qt::BottomToolBarArea, controlBar);

	controlBar->setToolButtonStyle(Qt::ToolButtonIconOnly);

	autoHideControlBar = false;
	cursorHideTimer = new QTimer(this);
	cursorHideTimer->setInterval(1500);
	cursorHideTimer->setSingleShot(true);
	connect(cursorHideTimer, SIGNAL(timeout()), this, SLOT(hideCursor()));

	// main area

	QWidget *widget = new QWidget(this);
	stackedLayout = new StackedLayout(widget);
	setCentralWidget(widget);

	mediaWidget = new MediaWidget(playerMenu, controlBar, collection, widget);
	connect(mediaWidget, SIGNAL(displayModeChanged()), this, SLOT(displayModeChanged()));
	connect(mediaWidget, SIGNAL(changeCaption(QString)), this, SLOT(setWindowTitle(QString)));
	connect(mediaWidget, SIGNAL(resizeToVideo(MediaWidget::ResizeFactor)),
		this, SLOT(resizeToVideo(MediaWidget::ResizeFactor)));

	// tabs - keep in sync with TabIndex enum!

	TabBase *startTab = new StartTab(this);
	tabs.append(startTab);
	stackedLayout->addWidget(startTab);

	playerTab = new PlayerTab(mediaWidget);
	playerTab->activate();
	tabs.append(playerTab);
	stackedLayout->addWidget(playerTab);

	playlistTab = new PlaylistTab(playlistMenu, collection, mediaWidget);
	tabs.append(playlistTab);
	stackedLayout->addWidget(playlistTab);

#if HAVE_DVB == 1
	dvbTab = new DvbTab(dvbMenu, collection, mediaWidget);
	connect(this, SIGNAL(mayCloseApplication(bool*,QWidget*)),
		dvbTab, SLOT(mayCloseApplication(bool*,QWidget*)));
	tabs.append(dvbTab);
	stackedLayout->addWidget(dvbTab);
#endif /* HAVE_DVB == 1 */

	currentTabIndex = StartTabId;

	// actions also have to work if the menu bar is hidden (fullscreen)
	collection->addAssociatedWidget(this);

	// restore custom key bindings
	collection->readSettings();

	// Tray menu
	menu = new QMenu(i18n("Kaffeine"), this);

	action = new QAction(i18n("Play &File"), this);
	connect(action, SIGNAL(triggered(bool)), this, SLOT(open()));
	menu->addAction(action);

	action = new QAction(i18n("Play &Audio CD"), this);
	connect(action, SIGNAL(triggered(bool)), this, SLOT(openAudioCd()));
	menu->addAction(action);

	action = new QAction(i18n("Play &Video CD"), this);
	connect(action, SIGNAL(triggered(bool)), this, SLOT(openVideoCd()));
	menu->addAction(action);

	action = new QAction(i18n("Play &DVD"), this);
	connect(action, SIGNAL(triggered(bool)), this, SLOT(openDvd()));
	menu->addAction(action);

#if HAVE_DVB == 1
	action = new QAction(i18n("&Watch Digital TV"), this);
	connect(action, SIGNAL(triggered(bool)), this, SLOT(playDvb()));
	menu->addAction(action);
#endif
	action = new QAction(i18n("&Quit"), this);
	connect(action, SIGNAL(triggered(bool)), this, SLOT(close()));
	menu->addAction(action);

	// Tray Icon and its menu
	QMenu *trayMenu = new QMenu(this);
	trayIcon = new QSystemTrayIcon(this);
	trayIcon->setContextMenu(trayMenu);
	trayIcon->setIcon(QIcon::fromTheme(QLatin1String("kaffeine"), QIcon(":kaffeine")));
	trayIcon->setToolTip(i18n("Kaffeine"));
	trayIcon->setContextMenu(menu);

	// make sure that the bars are visible (fullscreen -> quit -> restore -> hidden)
	menuBar->show();
	navigationBar->show();
	controlBar->show();
	trayIcon->show();

	// workaround setAutoSaveSettings() which doesn't accept "IconOnly" as initial state
	controlBar->setToolButtonStyle(Qt::ToolButtonIconOnly);

	// initialize random number generator
	qsrand(QTime(0, 0, 0).msecsTo(QTime::currentTime()));

	// initialize dbus objects
	QDBusConnection::sessionBus().registerObject(QLatin1String("/"), new MprisRootObject(this),
		QDBusConnection::ExportAllContents);
	QDBusConnection::sessionBus().registerObject(QLatin1String("/Player"),
		new MprisPlayerObject(this, mediaWidget, playlistTab, this),
		QDBusConnection::ExportAllContents);
	QDBusConnection::sessionBus().registerObject(QLatin1String("/TrackList"),
		new MprisTrackListObject(playlistTab, this), QDBusConnection::ExportAllContents);
#if HAVE_DVB == 1
	QDBusConnection::sessionBus().registerObject(QLatin1String("/Television"),
		new DBusTelevisionObject(dvbTab, this), QDBusConnection::ExportAllContents);
#endif /* HAVE_DVB == 1 */
	QDBusConnection::sessionBus().registerService(QLatin1String("org.mpris.kaffeine"));

	show();

	// set display mode
	switch (Configuration::instance()->getStartupDisplayMode()) {
	case Configuration::StartupNormalMode:
		// nothing to do
		break;
	case Configuration::StartupMinimalMode:
		mediaWidget->setDisplayMode(MediaWidget::MinimalMode);
		break;
	case Configuration::StartupFullScreenMode:
		mediaWidget->setDisplayMode(MediaWidget::FullScreenMode);
		break;
	case Configuration::StartupRememberLastSetting: {
		int value = KSharedConfig::openConfig()->group("MainWindow").readEntry("DisplayMode", 0);

		switch (value) {
		case 0:
			// nothing to do
			break;
		case 1:
			mediaWidget->setDisplayMode(MediaWidget::MinimalMode);
			break;
		case 2:
			mediaWidget->setDisplayMode(MediaWidget::FullScreenMode);
			break;
		}

		break;
	    }
	}

	parseArgs();
}
Пример #11
0
TopLevel::TopLevel() : KSystemTray()
{
	setBackgroundMode(X11ParentRelative);   // what for?
	QString n, key;
	unsigned int num;

	teas.clear();

	KConfig *config = kapp->config();
	config->setGroup("Teas");

	if (config->hasKey("Number")) {
		// assuming this is a new-style config
		num = config->readNumEntry("Number", 0);
		teas.resize(num);
		QString tempstr;
		for (unsigned int index=1; index<=num; ++index) {
			key.sprintf("Tea%d Time", index);
			tempstr = config->readEntry(key, NULL);
			teas[index-1].time = tempstr.toInt();
  			key.sprintf("Tea%d Name", index);
			teas[index-1].name = config->readEntry(key, NULL);
			// FIXME: check for non-existence!
  		}
		config->setGroup("General");
	} else {
		// either old-style config or first start, so provide some sensible defaults
		// (which are the same as in old-style kteatime)
		tea_struct temp;
		temp.name = i18n("Black Tea");
		temp.time = 180;
		teas.append(temp);
		temp.name = i18n("Earl Grey");
		temp.time = 300;
		teas.append(temp);
		temp.name = i18n("Fruit Tea");
		temp.time = 480;
		teas.append(temp);

		// switch back to old-style default group
		config->setGroup(NULL);
		// look for old-style "UserTea"-entry and add that one also
		if (config->hasKey("UserTea")) {
			num = config->readNumEntry("UserTea", 150);
			temp.name = i18n("Other Tea");
			temp.time = num;
			teas.append(temp);
		}
	}
	current_selected = config->readNumEntry("Tea", 0);
	if (current_selected >= teas.count())
		current_selected = 0;

	listempty = (teas.count() == 0);


	startAct = new KAction(i18n("&Start"), "1rightarrow", 0,
	                       this, SLOT(start()), actionCollection(), "start");
	stopAct = new KAction(i18n("Sto&p"), "cancel", 0,
	                      this, SLOT(stop()), actionCollection(), "stop");
	confAct = new KAction(i18n("&Configure..."), "configure", 0,
	                      this, SLOT(config()), actionCollection(), "configure");
	anonAct = new KAction(i18n("&Anonymous..."), 0, 0,
	                      this, SLOT(anonymous()), actionCollection(), "anonymous");
//	KAction *quitAct = actionCollection()->action("file_quit");

	// create app menu (displayed on right-click)
	menu = new QPopupMenu();
	menu->setCheckable(true);
	connect(menu, SIGNAL(activated(int)), this, SLOT(teaSelected(int)));

	// this menu will be displayed when no tea is steeping, and left mouse button is clicked
	start_menu = new QPopupMenu();
	start_menu->setCheckable(true);     // menu isn't tickable, but this gives some add. spacing
	connect(start_menu, SIGNAL(activated(int)), this, SLOT(teaStartSelected(int)));

	rebuildTeaMenus();      // populate tops of menus with tea-entries from config

	KHelpMenu* help = new KHelpMenu(this, KGlobal::instance()->aboutData(), false);
	KPopupMenu* helpMnu = help->menu();

	start_menu->insertSeparator();
	anonAct->plug(start_menu);

	menu->insertSeparator();
	anonAct->plug(menu);
	startAct->plug(menu);
	stopAct->plug(menu);
	menu->insertSeparator();
	confAct->plug(menu);
	menu->insertItem(SmallIcon("help"), i18n("&Help"), helpMnu);
	menu->insertItem(SmallIcon("exit"), i18n("Quit"), kapp, SLOT(quit()));
//	quitAct->plug(menu);    // FIXME: this doesn't seem to work with above definition of quitAct?
	                        //        (need special 'quit'-method?)

	// this menu will be displayed when a tea is steeping, and left mouse button is clicked
	steeping_menu = new QPopupMenu();
//	steeping_menu->insertItem(SmallIcon("cancel"), i18n("Just &Cancel Current"), this, SLOT(stop()));
	stopAct->plug(steeping_menu);   // FIXME: can provide different text for this incarnation?

//	start_menu->insertSeparator();
//	startAct->plug(start_menu);     // FIXME: include "start" entry here for quick access to current tea?

	// read remaining entries from config-file
	useNotify = config->readBoolEntry("Beep", true);    // "Beep" should really be named "Notify"
	usePopup = config->readBoolEntry("Popup", true);
	useAction = config->readBoolEntry("UseAction", true);
	action = config->readEntry("Action");
	useTrayVis = config->readBoolEntry("UseTrayVis", true);

	mugPixmap = loadIcon("mug");
	teaNotReadyPixmap = loadIcon("tea_not_ready");
	teaAnim1Pixmap = loadIcon("tea_anim1");
	teaAnim2Pixmap = loadIcon("tea_anim2");

	confdlg = 0L;
	anondlg = 0L;

	stop();                         // reset timer, disable some menu entries, etc.
}
GalleryWindow::GalleryWindow(Interface* interface, QWidget *parent, Gallery* pGallery)
    : KDialog(parent),
      m_interface(interface),
      mpGallery(pGallery),
      d(new Private(this))
{
    setWindowTitle( i18n("Gallery Export") );
    setButtons( KDialog::Close | KDialog::User1 | KDialog::Help);
    setModal(false);

    // About data.
    m_about = new KPAboutData(ki18n("Gallery Export"),
                              0,
                              KAboutData::License_GPL,
                              ki18n("A Kipi plugin to export image collections to a remote Gallery server."),
                              ki18n("(c) 2003-2005, Renchi Raju\n"
                                    "(c) 2006-2007, Colin Guthrie\n"
                                    "(c) 2006-2009, Gilles Caulier\n"
                                    "(c) 2008, Andrea Diamantini\n"));

    m_about->addAuthor(ki18n("Renchi Raju"), ki18n("Author"),
                       "renchi dot raju at gmail dot com");

    m_about->addAuthor(ki18n("Colin Guthrie"), ki18n("Maintainer"),
                       "kde at colin dot guthr dot ie");

    m_about->addAuthor(ki18n("Andrea Diamantini"), ki18n("Developer"),
                       "adjam7 at gmail dot com");

    m_about->addAuthor(ki18n("Gilles Caulier"), ki18n("Developer"),
                       "caulier dot gilles at gmail dot com");

    // help button

    disconnect(this, SIGNAL(helpClicked()),
               this, SLOT(slotHelp()));

    KHelpMenu *helpMenu = new KHelpMenu(this, m_about, false);
    helpMenu->menu()->removeAction(helpMenu->menu()->actions().first());
    QAction *handbook   = new QAction(i18n("Handbook"), this);
    connect(handbook, SIGNAL(triggered(bool)),
            this, SLOT(slotHelp()));
    helpMenu->menu()->insertAction(helpMenu->menu()->actions().first(), handbook);
    button(Help)->setMenu(helpMenu->menu());

    // User1 Button : to conf gallery settings
    KPushButton *confButton = button( User1 );
    confButton->setText( i18n("Settings") );
    confButton->setIcon( KIcon("configure") );
    connect(confButton, SIGNAL(clicked()),
            this, SLOT(slotSettings()) );

    // we need to let m_talker work..
    m_talker = new GalleryTalker(d->widget);

    // setting progressDlg and its numeric hints
    m_progressDlg = new QProgressDialog(this);
    m_progressDlg->setModal(true);
    m_progressDlg->setAutoReset(true);
    m_progressDlg->setAutoClose(true);
    m_uploadCount = 0;
    m_uploadTotal = 0;
    mpUploadList  = new QStringList;

    // connect functions
    connectSignals();

    // read Settings
    readSettings();

    slotDoLogin();
}
Пример #13
0
// Initialise Toolbar, Menus ScrollBar and other
void ktvschedule::init()
{
	// Creates central widgets
	
	tvgridbox = new QGroupBox ( this ); // Group box
	tvgridbox->setInsideMargin ( 15 );
		
	t_TVGrid=new TvGuideTable(this->tvgridbox, "t_TVGrid"); // Add TvGuideTable custom QTable
	
	QGridLayout *tvgridboxLayout = new QGridLayout( tvgridbox->layout() ); //Layout
	tvgridboxLayout->setAlignment ( Qt::AlignTop );
	tvgridboxLayout->addWidget ( t_TVGrid , 0 , 0 );
		
	setCentralWidget( tvgridbox );
  	tvgridbox->show();
	
////////////////////////////////
	//Check for home directory, if it does not exist, create it
	
       QString qstr(QDir::homeDirPath()+"/.kde/share/apps/ktvschedule"); //for some reason this only works with gcc 3.3 and not the previous version
       QDir d(qstr);
       if ( !d.exists() )
	{
		d.mkdir(qstr);
	}
	
	/*QDir d( QString(QDir::homeDirPath()+"/.kde/share/apps/ktvschedule") );
	if ( !d.exists() )
		{
			d.mkdir(QString(QDir::homeDirPath()+"/.kde/share/apps/ktvschedule"));
		}*/ // This worked for gcc 3.4 but not for 3.3

	
	//setRightJustification( TRUE );
	
////////////////////////////////

	this->setIcon( KGlobal::iconLoader()->loadIcon("ktvschedule", KIcon::Desktop) );
	
	// Creates the ToolBar
	KToolBar * TvToolBar = new KToolBar( this, KMainWindow::Top );
	
//////////////////////////////

	// Creates a QDateEdit Widget for future use
	date_show = new QDateEdit( QDate::currentDate() , TvToolBar );
	date_show->setOrder(QDateEdit::DMY);
	
////////////////////////////////
	// Define KActions
	
	 //KAction *actionGoHome = new KAction ( "Now Playing", KGlobal::iconLoader()->loadIcon("gohome", KIcon::NoGroup), CTRL+Key_P , t_TVGrid, SLOT (SetToCurrentTime() ), collector, "Now Playing");
	 
	 KAction *actionGoHome = new KAction ( i18n("Now &Playing"), "gohome", CTRL+Key_P , this, SLOT (SetToCurrentTime() ), actionCollection(), "Now Playing");

	 KAction *actionRefreshGuide = new KAction ( i18n("&Refresh Guide"), "reload", CTRL+Key_R , this, SLOT (RefreshXMLGuide() ), actionCollection(), "Refresh Guide");
	 
	 KAction *actionManageChannels = new KAction ( i18n("&Manage Channels"), "toggle_log", CTRL+Key_M , this, SLOT (channelList() ), actionCollection(), "Manage Channels");
	 
	 KAction *actionConfigure = new KAction ( i18n("&Configure"), "configure", CTRL+Key_C , this, SLOT (runConfig() ), actionCollection(), "Configure");
	 	 
	 KAction *actionExit = KStdAction::quit(this, SLOT(close()), 0);

	 KAction *actionPrevious = new KAction ( i18n("Pre&vious Day"), "previous", CTRL+Key_V , date_show, SLOT ( stepDown() ), actionCollection(), "PreviousDay");
 
	 KAction *actionNext = new KAction ( i18n("&Next Day"), "forward", CTRL+Key_N , date_show, SLOT ( stepUp() ), actionCollection(), "NextDay");
	 
	 KAction *actionEvent = KStdAction::configureNotifications(this, SLOT( notificationsEvent() ), actionCollection(), "settings_notifications" );
	 
	 KAction *actionFindCategory = new KAction (i18n("&Find Next Show"), "find", CTRL+Key_F , this, SLOT( findNextCategory() ), actionCollection(), "findnextshow");

//////////////////////////////////

	// Plug actions to ToolBar
	 
	
	 actionGoHome->plug ( TvToolBar);
	 actionRefreshGuide->plug (TvToolBar);
	 actionExit->plug (TvToolBar);
	 
	 TvToolBar->insertLineSeparator();
	 
	 actionManageChannels->plug (TvToolBar);
	 actionConfigure->plug (TvToolBar);

	 TvToolBar->insertLineSeparator();
	 
	 actionPrevious->plug (TvToolBar);
	 
	 // Add a QDateEdit widget for the ToolBar
	 TvToolBar->insertWidget (actionCollection()->count()+1,13, date_show );
	 
	 actionNext->plug (TvToolBar);
	 
	// Creates the KComboBox and adds it to the Toolbar
	 
	combo_Categories = new KComboBox(TvToolBar);
	combo_Categories->setMinimumWidth( combo_Categories->width ()+60); 
	combo_Categories->insertStringList(Categories);
	
	TvToolBar->insertWidget (actionCollection()->count()+1,15, combo_Categories);
	
	actionFindCategory->plug (TvToolBar);
//////////////////////////////////

	// Create menus
	 
	KPopupMenu *menuGrid = new KPopupMenu( this );
	KPopupMenu *menuConf = new KPopupMenu( this );
	
	menuBar()->insertItem( i18n("&Grid"), menuGrid );
  	menuBar()->insertItem( i18n("&Configure"), menuConf );
	
	// Plug KActions to menus
	
	actionGoHome->plug(menuGrid);
	actionRefreshGuide->plug(menuGrid);
	actionExit->plug(menuGrid);
	
	actionManageChannels->plug(menuConf);
	actionConfigure->plug(menuConf);
        actionEvent->plug(menuConf);
	
	KAboutData *_aboutData = new KAboutData("kTvSchedule", I18N_NOOP("KTvSchedule"), 
              "0.1.8", I18N_NOOP("TV Schedule.\n\n"
              "KDE Front end for TV Schedule programs.\n"
              "created by xmltv (tv_grab_xx)"),
              KAboutData::License_GPL, "(c) 2005, Alexios Beveratos",0,"http://www.kde-apps.org/content/show.php?content=22747","*****@*****.**");
	_aboutData->addAuthor("Alexios Beveratos", I18N_NOOP("Main Developper"), "*****@*****.**");
	_aboutData->addAuthor("Benoit Philipps",0,"*****@*****.**");
	//_aboutData->setHomepage("http://www.kde-apps.org/content/show.php?content=22747");
	//_aboutData->setBugAddress("http://developer.berlios.de/projects/ktvschedule/");
	
	 KHelpMenu *HelpMenu = new KHelpMenu( this, _aboutData );
 	 menuBar()->insertItem(i18n("&Help"), HelpMenu->menu() );	
	
//////////////////////////////////

	// Creates StatusBar
			  
	StatusBar = this->statusBar();
	led = new KLed(QColor ("#2EBB16"), KLed::On, KLed::Raised, KLed::Circular);
	StatusBar->addWidget ( led, 0, TRUE );
	
//////////////////////////////////

	// Other Initialisations
	
	date_show->setDate(QDate::currentDate ());
	date_show->setOrder(QDateEdit::DMY);
	
	FirstInput=QDate::currentDate();
	LastInput=QDate::currentDate();

//////////////////////////////////

	//Add connections
	connect( date_show, SIGNAL( valueChanged(const QDate&) ), this, SLOT( PopulateTvGrid() ) );
	//connect( combo_Categories, SIGNAL( activated(const QString &)),t_TVGrid,SLOT( highlightCategory(const QString& )));
	connect( combo_Categories, SIGNAL( activated(const QString &)),this,SLOT( highlightCategory(const QString& )));
	
	// Creates the scheduler class, and connects it. can be made better
	
	tvShowScheduler= new tvscheduler(); 
	connect( t_TVGrid, SIGNAL (infoContext(TvItem*) ), tvShowScheduler, SLOT (doNotMiss(TvItem*) ) );
	connect( t_TVGrid, SIGNAL (recordProgramSignal(TvItem* ) ), tvShowScheduler, SLOT (recordProgram(TvItem* ) ) );
	
/////////////////////////////////
	//If we use nxtvepg then disable some buttons
	if (Config().m_GrabberToUse == "nxtvepg")
	{
		actionRefreshGuide->setEnabled(FALSE);
		actionManageChannels->setEnabled(FALSE);
	}
}