Exemple #1
0
/*
 * KProgressDialog implementation
 */
KProgressDialog::KProgressDialog(QWidget* parent, const char* name,
                                 const QString& caption, const QString& text,
                                 bool modal)
    : KDialogBase(KDialogBase::Plain, caption, KDialogBase::Cancel,
                  KDialogBase::Cancel, parent, name, modal),
      mAutoClose(true),
      mAutoReset(false),
      mCancelled(false),
      mAllowCancel(true),
      mShown(false),
      mMinDuration(2000),
      d(new KProgressDialogPrivate)
{
#ifdef Q_WS_X11
    KWin::setIcons(winId(), kapp->icon(), kapp->miniIcon());
#endif
    mShowTimer = new QTimer(this);
    
    showButton(KDialogBase::Close, false);
    mCancelText = actionButton(KDialogBase::Cancel)->text();

    QFrame* mainWidget = plainPage();
    QVBoxLayout* layout = new QVBoxLayout(mainWidget, 10);

    mLabel = new QLabel(text, mainWidget);
    layout->addWidget(mLabel);

    mProgressBar = new KProgress(mainWidget);
    layout->addWidget(mProgressBar);

    connect(mProgressBar, SIGNAL(percentageChanged(int)),
            this, SLOT(slotAutoActions(int)));
    connect(mShowTimer, SIGNAL(timeout()), this, SLOT(slotAutoShow()));
    mShowTimer->start(mMinDuration, true);
}
Exemple #2
0
advancedTabDialog::advancedTabDialog(QWidget* parent, KConfig* config, const char* name)
    : KDialogBase(KDialogBase::Plain,
                  i18n("Advanced Options"),
                  KDialogBase::Ok |
                  KDialogBase::Apply |
                  KDialogBase::Cancel,
                  KDialogBase::Ok,
                  parent,
                  name,
                  true, true),
                  m_pConfig(config)
{
    connect(this, SIGNAL(applyClicked()),
            this, SLOT(save()));
    connect(this, SIGNAL(okClicked()),
            this, SLOT(save()));
    actionButton(Apply)->setEnabled(false);
    QFrame* page = plainPage();
    QVBoxLayout* layout = new QVBoxLayout(page);
    m_advancedWidget = new advancedTabOptions(page);
    layout->addWidget(m_advancedWidget);
    layout->addSpacing( 20 );
    layout->addStretch();

    connect(m_advancedWidget->m_pNewTabsInBackground, SIGNAL(clicked()), this, SLOT(changed()));
    connect(m_advancedWidget->m_pOpenAfterCurrentPage, SIGNAL(clicked()), this, SLOT(changed()));
    connect(m_advancedWidget->m_pTabConfirm, SIGNAL(clicked()), this, SLOT(changed()));
    connect(m_advancedWidget->m_pTabCloseActivatePrevious, SIGNAL(clicked()), this, SLOT(changed()));
    connect(m_advancedWidget->m_pPermanentCloseButton, SIGNAL(clicked()), this, SLOT(changed()));
    connect(m_advancedWidget->m_pKonquerorTabforExternalURL, SIGNAL(clicked()), this, SLOT(changed()));
    connect(m_advancedWidget->m_pPopupsWithinTabs, SIGNAL(clicked()), this, SLOT(changed()));

    load();
}
Exemple #3
0
void VCardViewerDialog::updateView()
{
  mView->setAddressee( *mIt );

  KABC::Addressee::List::Iterator it = mIt;
  actionButton( Apply )->setEnabled( (++it) != mContacts.end() );
}
Exemple #4
0
QWidget* QuickButtonDisplay::create() {
    buttonWidget = new QWidget;
    hLayout = new QHBoxLayout(buttonWidget);
    hLayout->setContentsMargins(25, 0, 25, 0);

    sword = actionButton("sword", BUTTON_AXE_ICO,
        settings->getParameter("QuickButton/sword", "").toString());
    hLayout->addWidget(sword);
    connect(sword, SIGNAL(customContextMenuRequested(const QPoint&)),
            this, SLOT(swordButtonEdit(const QPoint&)));

    bow = actionButton("bow", BUTTON_BOW_ICO,
        settings->getParameter("QuickButton/bow", "").toString());
    hLayout->addWidget(bow);
    connect(bow, SIGNAL(customContextMenuRequested(const QPoint &)),
            this, SLOT(bowButtonEdit(const QPoint&)));

    shield = actionButton("shield", BUTTON_SHIELD_ICO,
        settings->getParameter("QuickButton/shield", "").toString());
    hLayout->addWidget(shield);
    connect(shield, SIGNAL(customContextMenuRequested(const QPoint &)),
            this, SLOT(shieldButtonEdit(const QPoint&)));

    bag = actionButton("bag", BUTTON_BAG_ICO,
        settings->getParameter("QuickButton/bag", "").toString());
    hLayout->addWidget(bag);
    connect(bag, SIGNAL(customContextMenuRequested(const QPoint &)),
            this, SLOT(bagButtonEdit(const QPoint&)));

    xsword = actionButton("xsword", BUTTON_XAXE_ICO,
        settings->getParameter("QuickButton/xsword", "").toString());
    hLayout->addWidget(xsword);
    connect(xsword, SIGNAL(customContextMenuRequested(const QPoint &)),
            this, SLOT(xswordButtonEdit(const QPoint&)));

    xbow = actionButton("xbow", BUTTON_XBOW_ICO,
        settings->getParameter("QuickButton/xbow", "").toString());
    hLayout->addWidget(xbow);
    connect(xbow, SIGNAL(customContextMenuRequested(const QPoint &)),
            this, SLOT(xbowButtonEdit(const QPoint&)));

    xshield = actionButton("xshield", BUTTON_XSHIELD_ICO,
        settings->getParameter("QuickButton/xshield", "").toString());
    hLayout->addWidget(xshield);
    connect(xshield, SIGNAL(customContextMenuRequested(const QPoint &)),
            this, SLOT(xshieldButtonEdit(const QPoint&)));

    buttonWidget->setLayout(hLayout);

    return buttonWidget;
}
Exemple #5
0
void advancedTabDialog::load()
{
    m_pConfig->setGroup("FMSettings");
    m_advancedWidget->m_pNewTabsInBackground->setChecked( ! (m_pConfig->readBoolEntry( "NewTabsInFront", false )) );
    m_advancedWidget->m_pOpenAfterCurrentPage->setChecked( m_pConfig->readBoolEntry( "OpenAfterCurrentPage", false ) );
    m_advancedWidget->m_pPermanentCloseButton->setChecked( m_pConfig->readBoolEntry( "PermanentCloseButton", false ) );
    m_advancedWidget->m_pKonquerorTabforExternalURL->setChecked( m_pConfig->readBoolEntry( "KonquerorTabforExternalURL", false ) );
    m_advancedWidget->m_pPopupsWithinTabs->setChecked( m_pConfig->readBoolEntry( "PopupsWithinTabs", false ) );
    m_advancedWidget->m_pTabCloseActivatePrevious->setChecked( m_pConfig->readBoolEntry( "TabCloseActivatePrevious", false ) );

    m_pConfig->setGroup("Notification Messages");
    m_advancedWidget->m_pTabConfirm->setChecked( !m_pConfig->hasKey("MultipleTabConfirm") );

    actionButton(Apply)->setEnabled(false);
}
NotificationDialog::NotificationDialog( KFileItem medium, NotifierSettings *settings,
                                        TQWidget* parent, const char* name )
	: KDialogBase( parent, name, false, i18n( "Medium Detected" ), Ok|Cancel|User1, Ok, true),
	  m_medium(medium), m_settings( settings )
{
	setCaption( TDEIO::decodeFileName(m_medium.name()) );
	clearWState( WState_Polished );

	TQWidget *page = new TQWidget( this );
	setMainWidget(page);
	TQVBoxLayout *topLayout = new TQVBoxLayout( page, 0, spacingHint() );

	m_view = new NotificationDialogView( page );

	topLayout->addWidget(m_view);
	m_view->iconLabel->setPixmap( m_medium.pixmap(64) );
	m_view->mimetypeLabel->setText( i18n( "<b>Medium type:</b>" ) + " "
	                              + m_medium.mimeTypePtr()->comment() );

	updateActionsListBox();

	resize( TQSize(400,400).expandedTo( minimumSizeHint() ) );


	m_actionWatcher = new KDirWatch();
	TQString services_dir
		= locateLocal( "data", "konqueror/servicemenus", true );
	m_actionWatcher->addDir( services_dir );

	setButtonText( User1, i18n("Configure...") );

	connect( m_actionWatcher, TQT_SIGNAL( dirty( const TQString & ) ),
	         this, TQT_SLOT( slotActionsChanged( const TQString & ) ) );
	connect( this , TQT_SIGNAL( okClicked() ),
	         this, TQT_SLOT( slotOk() ) );
	connect( this, TQT_SIGNAL( user1Clicked() ),
	         this, TQT_SLOT( slotConfigure() ) );
	connect( m_view->actionsList, TQT_SIGNAL( doubleClicked ( TQListBoxItem*, const TQPoint & ) ),
	         this, TQT_SLOT( slotOk() ) );

	connect( this, TQT_SIGNAL( finished() ),
	         this, TQT_SLOT( delayedDestruct() ) );

	m_actionWatcher->startScan();
	TQPushButton * btn = actionButton( Ok );
	btn->setFocus();
}
Exemple #7
0
void advancedTabDialog::save()
{
    m_pConfig->setGroup("FMSettings");
    m_pConfig->writeEntry( "NewTabsInFront", !(m_advancedWidget->m_pNewTabsInBackground->isChecked()) );
    m_pConfig->writeEntry( "OpenAfterCurrentPage", m_advancedWidget->m_pOpenAfterCurrentPage->isChecked() );
    m_pConfig->writeEntry( "PermanentCloseButton", m_advancedWidget->m_pPermanentCloseButton->isChecked() );
    m_pConfig->writeEntry( "KonquerorTabforExternalURL", m_advancedWidget->m_pKonquerorTabforExternalURL->isChecked() );
    m_pConfig->writeEntry( "PopupsWithinTabs", m_advancedWidget->m_pPopupsWithinTabs->isChecked() );
    m_pConfig->writeEntry( "TabCloseActivatePrevious", m_advancedWidget->m_pTabCloseActivatePrevious->isChecked() );
    m_pConfig->sync();

    // It only matters wether the key is present, its value has no meaning
    m_pConfig->setGroup("Notification Messages");
    if ( m_advancedWidget->m_pTabConfirm->isChecked() ) m_pConfig->deleteEntry( "MultipleTabConfirm" );
    else m_pConfig->writeEntry( "MultipleTabConfirm", true );

    QByteArray data;
    if ( !KApplication::kApplication()->dcopClient()->isAttached() )
      kapp->dcopClient()->attach();
    KApplication::kApplication()->dcopClient()->send( "konqueror*", "KonquerorIface", "reparseConfiguration()", data );

    actionButton(Apply)->setEnabled(false);
}
Exemple #8
0
void KateReplacePrompt::slotOk ()
{ // Search Next
  done(KateSearch::srNo);
  actionButton(Ok)->setFocus();
}
KateConfigDialog::KateConfigDialog(KateMainWindow *parent, Kate::View *view)
    : KDialogBase(KDialogBase::TreeList, i18n("Configure"), KDialogBase::Ok | KDialogBase::Apply | KDialogBase::Cancel | KDialogBase::Help,
                  KDialogBase::Ok, parent, "configdialog")
{
    KConfig *config = KateApp::self()->config();

    KWin::setIcons(winId(), KateApp::self()->icon(), KateApp::self()->miniIcon());

    actionButton(KDialogBase::Apply)->setEnabled(false);

    mainWindow = parent;

    setMinimumSize(600, 400);

    v = view;

    pluginPages.setAutoDelete(false);
    editorPages.setAutoDelete(false);

    QStringList path;

    setShowIconsInTreeList(true);

    path.clear();
    path << i18n("Application");
    setFolderIcon(path, SmallIcon("kate", KIcon::SizeSmall));

    path.clear();

    // BEGIN General page
    path << i18n("Application") << i18n("General");
    QFrame *frGeneral = addPage(path, i18n("General Options"), BarIcon("gohome", KIcon::SizeSmall));

    QVBoxLayout *lo = new QVBoxLayout(frGeneral);
    lo->setSpacing(KDialog::spacingHint());
    config->setGroup("General");

    // GROUP with the one below: "Appearance"
    QButtonGroup *bgStartup = new QButtonGroup(1, Qt::Horizontal, i18n("&Appearance"), frGeneral);
    lo->addWidget(bgStartup);

    // show full path in title
    config->setGroup("General");
    cb_fullPath = new QCheckBox(i18n("&Show full path in title"), bgStartup);
    cb_fullPath->setChecked(mainWindow->viewManager()->getShowFullPath());
    QWhatsThis::add(cb_fullPath, i18n("If this option is checked, the full document path will be shown in the window caption."));
    connect(cb_fullPath, SIGNAL(toggled(bool)), this, SLOT(slotChanged()));


    // GROUP with the one below: "Behavior"
    bgStartup = new QButtonGroup(1, Qt::Horizontal, i18n("&Behavior"), frGeneral);
    lo->addWidget(bgStartup);

    // sync the konsole ?
    cb_syncKonsole = new QCheckBox(bgStartup);
    cb_syncKonsole->setText(i18n("Sync &terminal emulator with active document"));
    cb_syncKonsole->setChecked(parent->syncKonsole);
    QWhatsThis::add(cb_syncKonsole, i18n("If this is checked, the built in Konsole will <code>cd</code> to the directory "
                                         "of the active document when started and whenever the active document changes, "
                                         "if the document is a local file."));
    connect(cb_syncKonsole, SIGNAL(toggled(bool)), this, SLOT(slotChanged()));

    // modified files notification
    cb_modNotifications = new QCheckBox(i18n("Wa&rn about files modified by foreign processes"), bgStartup);
    cb_modNotifications->setChecked(parent->modNotification);
    QWhatsThis::add(cb_modNotifications, i18n("If enabled, when Kate receives focus you will be asked what to do with "
                                              "files that have been modified on the hard disk. If not enabled, you will "
                                              "be asked what to do with a file that has been modified on the hard disk only "
                                              "when that file gains focus inside Kate."));
    connect(cb_modNotifications, SIGNAL(toggled(bool)), this, SLOT(slotChanged()));

    // GROUP with the one below: "Meta-informations"
    bgStartup = new QButtonGroup(1, Qt::Horizontal, i18n("Meta-Information"), frGeneral);
    lo->addWidget(bgStartup);

    // save meta infos
    cb_saveMetaInfos = new QCheckBox(bgStartup);
    cb_saveMetaInfos->setText(i18n("Keep &meta-information past sessions"));
    cb_saveMetaInfos->setChecked(KateDocManager::self()->getSaveMetaInfos());
    QWhatsThis::add(cb_saveMetaInfos, i18n("Check this if you want document configuration like for example "
                                           "bookmarks to be saved past editor sessions. The configuration will be "
                                           "restored if the document has not changed when reopened."));
    connect(cb_saveMetaInfos, SIGNAL(toggled(bool)), this, SLOT(slotChanged()));

    // meta infos days
    QHBox *hbDmf = new QHBox(bgStartup);
    hbDmf->setEnabled(KateDocManager::self()->getSaveMetaInfos());
    QLabel *lDmf = new QLabel(i18n("&Delete unused meta-information after:"), hbDmf);
    sb_daysMetaInfos = new QSpinBox(0, 180, 1, hbDmf);
    sb_daysMetaInfos->setSpecialValueText(i18n("(never)"));
    sb_daysMetaInfos->setSuffix(i18n(" day(s)"));
    sb_daysMetaInfos->setValue(KateDocManager::self()->getDaysMetaInfos());
    lDmf->setBuddy(sb_daysMetaInfos);
    connect(cb_saveMetaInfos, SIGNAL(toggled(bool)), hbDmf, SLOT(setEnabled(bool)));
    connect(sb_daysMetaInfos, SIGNAL(valueChanged(int)), this, SLOT(slotChanged()));

    lo->addStretch(1); // :-] works correct without autoadd
    // END General page

    path.clear();

    // BEGIN Session page
    path << i18n("Application") << i18n("Sessions");
    QFrame *frSessions = addPage(path, i18n("Session Management"), BarIcon("history", KIcon::SizeSmall));

    lo = new QVBoxLayout(frSessions);
    lo->setSpacing(KDialog::spacingHint());

    // GROUP with the one below: "Startup"
    bgStartup = new QButtonGroup(1, Qt::Horizontal, i18n("Elements of Sessions"), frSessions);
    lo->addWidget(bgStartup);

    // restore view  config
    cb_restoreVC = new QCheckBox(bgStartup);
    cb_restoreVC->setText(i18n("Include &window configuration"));
    config->setGroup("General");
    cb_restoreVC->setChecked(config->readBoolEntry("Restore Window Configuration", true));
    QWhatsThis::add(cb_restoreVC, i18n("Check this if you want all your views and frames restored each time you open Kate"));
    connect(cb_restoreVC, SIGNAL(toggled(bool)), this, SLOT(slotChanged()));

    QRadioButton *rb1, *rb2, *rb3;

    sessions_start = new QButtonGroup(1, Qt::Horizontal, i18n("Behavior on Application Startup"), frSessions);
    lo->add(sessions_start);

    sessions_start->setRadioButtonExclusive(true);
    sessions_start->insert(rb1 = new QRadioButton(i18n("&Start new session"), sessions_start), 0);
    sessions_start->insert(rb2 = new QRadioButton(i18n("&Load last-used session"), sessions_start), 1);
    sessions_start->insert(rb3 = new QRadioButton(i18n("&Manually choose a session"), sessions_start), 2);

    config->setGroup("General");
    QString sesStart(config->readEntry("Startup Session", "manual"));
    if(sesStart == "new")
        sessions_start->setButton(0);
    else if(sesStart == "last")
        sessions_start->setButton(1);
    else
        sessions_start->setButton(2);

    connect(rb1, SIGNAL(toggled(bool)), this, SLOT(slotChanged()));
    connect(rb2, SIGNAL(toggled(bool)), this, SLOT(slotChanged()));
    connect(rb3, SIGNAL(toggled(bool)), this, SLOT(slotChanged()));

    sessions_exit = new QButtonGroup(1, Qt::Horizontal, i18n("Behavior on Application Exit or Session Switch"), frSessions);
    lo->add(sessions_exit);

    sessions_exit->setRadioButtonExclusive(true);
    sessions_exit->insert(rb1 = new QRadioButton(i18n("&Do not save session"), sessions_exit), 0);
    sessions_exit->insert(rb2 = new QRadioButton(i18n("&Save session"), sessions_exit), 1);
    sessions_exit->insert(rb3 = new QRadioButton(i18n("&Ask user"), sessions_exit), 2);

    config->setGroup("General");
    QString sesExit(config->readEntry("Session Exit", "save"));
    if(sesExit == "discard")
        sessions_exit->setButton(0);
    else if(sesExit == "save")
        sessions_exit->setButton(1);
    else
        sessions_exit->setButton(2);

    connect(rb1, SIGNAL(toggled(bool)), this, SLOT(slotChanged()));
    connect(rb2, SIGNAL(toggled(bool)), this, SLOT(slotChanged()));
    connect(rb3, SIGNAL(toggled(bool)), this, SLOT(slotChanged()));

    lo->addStretch(1); // :-] works correct without autoadd
    // END Session page

    path.clear();

    // file selector page
    path << i18n("Application") << i18n("File Selector");

    QVBox *page = addVBoxPage(path, i18n("File Selector Settings"), BarIcon("fileopen", KIcon::SizeSmall));
    fileSelConfigPage = new KFSConfigPage(page, "file selector config page", mainWindow->fileselector);
    connect(fileSelConfigPage, SIGNAL(changed()), this, SLOT(slotChanged()));
    path.clear();

    path << i18n("Application") << i18n("Document List");
    page = addVBoxPage(path, i18n("Document List Settings"), BarIcon("view_text", KIcon::SizeSmall));
    filelistConfigPage = new KFLConfigPage(page, "file list config page", mainWindow->filelist);
    connect(filelistConfigPage, SIGNAL(changed()), this, SLOT(slotChanged()));
    path.clear();

    path << i18n("Application") << i18n("Plugins");
    /*QVBox **/ page = addVBoxPage(path, i18n("Plugin Manager"), BarIcon("connect_established", KIcon::SizeSmall));
    KateConfigPluginPage *configPluginPage = new KateConfigPluginPage(page, this);
    connect(configPluginPage, SIGNAL(changed()), this, SLOT(slotChanged()));

    // Tools->External Tools menu
    path.clear();
    path << i18n("Application") << i18n("External Tools");
    page = addVBoxPage(path, i18n("External Tools"), BarIcon("configure", KIcon::SizeSmall));
    configExternalToolsPage = new KateExternalToolsConfigWidget(page, "external tools config page");
    connect(configExternalToolsPage, SIGNAL(changed()), this, SLOT(slotChanged()));

    // editor widgets from kwrite/kwdialog
    path.clear();
    path << i18n("Editor");
    setFolderIcon(path, SmallIcon("edit", KIcon::SizeSmall));

    for(uint i = 0; i < KTextEditor::configInterfaceExtension(v->document())->configPages(); i++)
    {
        path.clear();
        path << i18n("Editor") << KTextEditor::configInterfaceExtension(v->document())->configPageName(i);
        /*QVBox **/ page = addVBoxPage(path, KTextEditor::configInterfaceExtension(v->document())->configPageFullName(i),
                                       KTextEditor::configInterfaceExtension(v->document())->configPagePixmap(i, KIcon::SizeSmall));

        KTextEditor::ConfigPage *cPage = KTextEditor::configInterfaceExtension(v->document())->configPage(i, page);
        connect(cPage, SIGNAL(changed()), this, SLOT(slotChanged()));
        editorPages.append(cPage);
    }

    KatePluginList &pluginList(KatePluginManager::self()->pluginList());
    for(unsigned int i = 0; i < pluginList.size(); ++i)
    {
        if(pluginList[i].load && Kate::pluginConfigInterfaceExtension(pluginList[i].plugin))
            addPluginPage(pluginList[i].plugin);
    }

    enableButtonSeparator(true);
    dataChanged = false;
    unfoldTreeList();
}
void KateConfigDialog::slotChanged()
{
    dataChanged = true;
    actionButton(KDialogBase::Apply)->setEnabled(true);
}
void KateConfigDialog::slotApply()
{
    KConfig *config = KateApp::self()->config();

    // if data changed apply the kate app stuff
    if(dataChanged)
    {
        config->setGroup("General");

        config->writeEntry("Restore Window Configuration", cb_restoreVC->isChecked());

        int bu = sessions_start->id(sessions_start->selected());

        if(bu == 0)
            config->writeEntry("Startup Session", "new");
        else if(bu == 1)
            config->writeEntry("Startup Session", "last");
        else
            config->writeEntry("Startup Session", "manual");

        bu = sessions_exit->id(sessions_exit->selected());

        if(bu == 0)
            config->writeEntry("Session Exit", "discard");
        else if(bu == 1)
            config->writeEntry("Session Exit", "save");
        else
            config->writeEntry("Session Exit", "ask");

        config->writeEntry("Save Meta Infos", cb_saveMetaInfos->isChecked());
        KateDocManager::self()->setSaveMetaInfos(cb_saveMetaInfos->isChecked());

        config->writeEntry("Days Meta Infos", sb_daysMetaInfos->value());
        KateDocManager::self()->setDaysMetaInfos(sb_daysMetaInfos->value());

        config->writeEntry("Modified Notification", cb_modNotifications->isChecked());
        mainWindow->modNotification = cb_modNotifications->isChecked();

        mainWindow->syncKonsole = cb_syncKonsole->isChecked();

        fileSelConfigPage->apply();

        filelistConfigPage->apply();

        configExternalToolsPage->apply();
        KateExternalToolsCommand::self()->reload();
        for(uint i = 0; i < KateApp::self()->mainWindows(); i++)
        {
            KateMainWindow *win = KateApp::self()->mainWindow(i);
            win->externalTools->reload();
        }
        // mainWindow->externalTools->reload();

        mainWindow->viewManager()->setShowFullPath(cb_fullPath->isChecked()); // hm, stored 2 places :(

        mainWindow->saveOptions();

        // save plugin config !!
        KateApp::self()->pluginManager()->writeConfig();
    }

    //
    // editor config ! (the apply() methode will check the changed state internally)
    //
    for(uint i = 0; i < editorPages.count(); i++)
    {
        editorPages.at(i)->apply();
    }

    v->getDoc()->writeConfig(config);

    //
    // plugins config ! (the apply() methode SHOULD check the changed state internally)
    //
    for(uint i = 0; i < pluginPages.count(); i++)
    {
        pluginPages.at(i)->page->apply();
    }

    config->sync();

    dataChanged = false;
    actionButton(KDialogBase::Apply)->setEnabled(false);
}
Exemple #12
0
void advancedTabDialog::changed()
{
    actionButton(Apply)->setEnabled(true);
}
Exemple #13
0
void KateReplacePrompt::slotUser2 ()
{ // Replace & Close
  done(KateSearch::srLast);
  actionButton(User2)->setFocus();
}
Exemple #14
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);


  }
Exemple #15
0
void KateReplacePrompt::slotClose ()
{ // Close
  done(KateSearch::srCancel);
  actionButton(Close)->setFocus();
}
Exemple #16
0
void KateReplacePrompt::slotUser1 ()
{ // Replace All
  done(KateSearch::srAll);
  actionButton(User1)->setFocus();
}
Exemple #17
0
Kleo::KeyApprovalDialog::KeyApprovalDialog( const std::vector<Item> & recipients,
                                      const std::vector<GpgME::Key> & sender,
                                      QWidget * parent, const char * name,
                                      bool modal )
  : KDialogBase( parent, name, modal, i18n("Encryption Key Approval"), Ok|Cancel, Ok ),
    d( 0 )
{
  assert( !recipients.empty() );

  d = new Private();

  QFrame *page = makeMainWidget();
  QVBoxLayout * vlay = new QVBoxLayout( page, 0, spacingHint() );

  vlay->addWidget( new QLabel( i18n("The following keys will be used for encryption:"), page ) );

  QScrollView * sv = new QScrollView( page );
  sv->setResizePolicy( QScrollView::AutoOneFit );
  vlay->addWidget( sv );

  QWidget * view = new QWidget( sv->viewport() );

  QGridLayout * glay = new QGridLayout( view, 3, 2, marginHint(), spacingHint() );
  glay->setColStretch( 1, 1 );
  sv->addChild( view );

  int row = -1;

  if ( !sender.empty() ) {
    ++row;
    glay->addWidget( new QLabel( i18n("Your keys:"), view ), row, 0 );
    d->selfRequester = new EncryptionKeyRequester( true, EncryptionKeyRequester::AllProtocols, view );
    d->selfRequester->setKeys( sender );
    glay->addWidget( d->selfRequester, row, 1 );
    ++row;
    glay->addMultiCellWidget( new KSeparator( Horizontal, view ), row, row, 0, 1 );
  }

  const QStringList prefs = preferencesStrings();

  for ( std::vector<Item>::const_iterator it = recipients.begin() ; it != recipients.end() ; ++it ) {
    ++row;
    glay->addWidget( new QLabel( i18n("Recipient:"), view ), row, 0 );
    glay->addWidget( new QLabel( it->address, view ), row, 1 );
    d->addresses.push_back( it->address );

    ++row;
    glay->addWidget( new QLabel( i18n("Encryption keys:"), view ), row, 0 );
    KeyRequester * req = new EncryptionKeyRequester( true, EncryptionKeyRequester::AllProtocols, view );
    req->setKeys( it->keys );
    glay->addWidget( req, row, 1 );
    d->requesters.push_back( req );

    ++row;
    glay->addWidget( new QLabel( i18n("Encryption preference:"), view ), row, 0 );
    QComboBox * cb = new QComboBox( false, view );
    cb->insertStringList( prefs );
    glay->addWidget( cb, row, 1 );
    cb->setCurrentItem( pref2cb( it->pref ) );
    connect( cb, SIGNAL(activated(int)), SLOT(slotPrefsChanged()) );
    d->preferences.push_back( cb );
  }

  // calculate the optimal width for the dialog
  const int dialogWidth = marginHint()
                  + sv->frameWidth()
                  + view->sizeHint().width()
                  + sv->verticalScrollBar()->sizeHint().width()
                  + sv->frameWidth()
                  + marginHint()
                  + 2;
  // calculate the optimal height for the dialog
  const int dialogHeight = marginHint()
                   + fontMetrics().height()
                   + spacingHint()
                   + sv->frameWidth()
                   + view->sizeHint().height()
                   + sv->horizontalScrollBar()->sizeHint().height()
                   + sv->frameWidth()
                   + spacingHint()
                   + actionButton( KDialogBase::Cancel )->sizeHint().height()
                   + marginHint()
                   + 2;

  // don't make the dialog too large
  const QRect desk = KGlobalSettings::desktopGeometry( this );
  setInitialSize( QSize( kMin( dialogWidth, 3 * desk.width() / 4 ),
			 kMin( dialogHeight, 7 * desk.height() / 8 ) ) );
}
Exemple #18
0
void KateReplacePrompt::slotUser3 ()
{ // Replace
  done(KateSearch::srYes);
  actionButton(User3)->setFocus();
}
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();
}