Esempio n. 1
0
void ValgrindDialog::valgrindTextChanged()
{
    if (m_type == Memcheck)
        enableButtonOK( !w->valExecutableEdit->lineEdit()->text().isEmpty() &&  !w->executableEdit->lineEdit()->text().isEmpty() );
    else if (m_type == Calltree)
        enableButtonOK( !w->executableEdit->lineEdit()->text().isEmpty() &&  !w->ctExecutableEdit->lineEdit()->text().isEmpty() && !w->kcExecutableEdit->lineEdit()->text().isEmpty() );
}
Esempio n. 2
0
void LogDialog::updateButtons()
{
    // no versions selected?
    if( selectionA.isEmpty() && selectionB.isEmpty() )
    {
        enableButton(User1, true);  // annotate
        enableButton(User2, false); // diff
        enableButtonOK(false);      // view
        enableButtonApply(false);   // create patch
    }
    // both versions selected?
    else if( !selectionA.isEmpty() && !selectionB.isEmpty() )
    {
        enableButton(User1, false); // annotate
        enableButton(User2, true);  // diff
        enableButtonOK(false);      // view
        enableButtonApply(true);    // create patch
    }
    // only single version selected?
    else
    {
        enableButton(User1, true);  // annotate
        enableButton(User2, true);  // diff
        enableButtonOK(true);       // view
        enableButtonApply(true);    // create patch
    }
}
Esempio n. 3
0
KLineEditDlg::KLineEditDlg( const QString&_text, const QString& _value,
                            QWidget *parent )
    : KDialogBase( Plain, QString::null, Ok|Cancel|User1, Ok, parent, 0L, true,
                   true, KStdGuiItem::clear() )
{
    QVBoxLayout *topLayout = new QVBoxLayout( plainPage(), 0, spacingHint() );
    QLabel *label = new QLabel(_text, plainPage() );
    topLayout->addWidget( label, 1 );

    edit = new KLineEdit( plainPage(), 0L );
    edit->setMinimumWidth(edit->sizeHint().width() * 3);
    label->setBuddy(edit);  // please "scheck" style
    //  connect( edit, SIGNAL(returnPressed()), SLOT(accept()) );
    connect( edit, SIGNAL(textChanged(const QString&)),
             SLOT(slotTextChanged(const QString&)) );
    topLayout->addWidget( edit, 1 );

    connect( this, SIGNAL(user1Clicked()), this, SLOT(slotClear()) );
    edit->setText( _value );
    if ( _value.isEmpty() )
    {
        enableButtonOK( false );
        enableButton(KDialogBase::User1, false);
    }
    edit->setSelection(0, edit->text().length());
    edit->setFocus();
}
Esempio n. 4
0
bool KImportDialog::setFile(const QString &file)
{
    enableButtonOK(!file.isEmpty());
    kdDebug(5300) << "KImportDialog::setFile(): " << file << endl;

    QFile f(file);

    if(f.open(IO_ReadOnly))
    {
        mFile = "";
        QTextStream t(&f);
        mFile = t.read();
        //    while (!t.eof()) mFile.append(t.readLine());
        f.close();

        readFile();

        //    mEndRow->setValue( mData.count() );

        return true;
    }
    else
    {
        kdDebug(5300) << " Open failed" << endl;
        return false;
    }
}
Esempio n. 5
0
KWMailMergeVariableInsertDia::KWMailMergeVariableInsertDia( QWidget *parent, KWMailMergeDataBase *db )
  : KDialogBase( Plain, i18n( "Mail Merge - Variable Name" ),
                 Ok | Cancel, Ok, parent, "", true )
{
  m_db=db;
  QWidget *page = plainPage();

  QVBoxLayout *layout = new QVBoxLayout( page, marginHint(), spacingHint() );
  layout->setAutoAdd( true );

  QLabel *l = new QLabel( i18n( "Name:" ), page );
  l->setMaximumHeight( l->sizeHint().height() );
  names = new QListBox( page );

  QMap< QString, QString >::ConstIterator it = db->getRecordEntries().begin();
  for ( ; it != db->getRecordEntries().end(); ++it )
    names->insertItem( m_db->version() ?it.data():it.key(), -1 );

  setInitialSize( QSize( 350, 400 ) );
  connect( names, SIGNAL( selectionChanged() ),
           this, SLOT( slotSelectionChanged() ) );
  connect( names, SIGNAL( doubleClicked( QListBoxItem* ) ),
           this, SLOT( slotOk() ) );

  setFocus();
  enableButtonOK( names->currentItem() != -1 );
}
Esempio n. 6
0
ProfileDialog::ProfileDialog(QWidget *parent, const char *name, bool modal)
    : KDialogBase(parent, name, modal, i18n("Load Profile"), Ok | Cancel, Ok, true)
{
    // tmp. vars:
    QWidget *page = makeMainWidget();
    QVBoxLayout *vlay = new QVBoxLayout(page, 0, spacingHint());

    mListView = new KListView(page, "mListView");
    mListView->addColumn(i18n("Available Profiles"));
    mListView->addColumn(i18n("Description"));
    mListView->setFullWidth(true);
    mListView->setAllColumnsShowFocus(true);
    mListView->setSorting(-1);

    vlay->addWidget(new QLabel(mListView,
                               i18n("&Select a profile and click 'OK' to "
                                    "load its settings:"), page));
    vlay->addWidget(mListView, 1);

    setup();

    connect(mListView, SIGNAL(selectionChanged()),
            SLOT(slotSelectionChanged()));
    connect(mListView, SIGNAL(doubleClicked(QListViewItem *, const QPoint &, int)),
            SLOT(slotOk()));

    connect(this, SIGNAL(finished()), SLOT(delayedDestruct()));

    enableButtonOK(false);
}
Esempio n. 7
0
NewIdentityDialog::NewIdentityDialog(const QStringList &identities,
                                     QWidget *parent, const char *name,
                                     bool modal)
    : KDialogBase(parent, name, modal, i18n("New Identity"),
                  Ok | Cancel | Help, Ok, true)
{
    setHelp(QString::fromLatin1("configure-identity-newidentitydialog"));
    QWidget *page = makeMainWidget();
    QVBoxLayout *vlay = new QVBoxLayout(page, 0, spacingHint());

    // row 0: line edit with label
    QHBoxLayout *hlay = new QHBoxLayout(vlay);    // inherits spacing
    mLineEdit = new KLineEdit(page);
    mLineEdit->setFocus();
    hlay->addWidget(new QLabel(mLineEdit, i18n("&New identity:"), page));
    hlay->addWidget(mLineEdit, 1);
    connect(mLineEdit, SIGNAL(textChanged(const QString &)),
            this, SLOT(slotEnableOK(const QString &)));

    mButtonGroup = new QButtonGroup(page);
    mButtonGroup->hide();

    // row 1: radio button
    QRadioButton *radio = new QRadioButton(i18n("&With empty fields"), page);
    radio->setChecked(true);
    mButtonGroup->insert(radio, Empty);
    vlay->addWidget(radio);

    // row 2: radio button
    radio = new QRadioButton(i18n("&Use Control Center settings"), page);
    mButtonGroup->insert(radio, ControlCenter);
    vlay->addWidget(radio);

    // row 3: radio button
    radio = new QRadioButton(i18n("&Duplicate existing identity"), page);
    mButtonGroup->insert(radio, ExistingEntry);
    vlay->addWidget(radio);

    // row 4: combobox with existing identities and label
    hlay = new QHBoxLayout(vlay);   // inherits spacing
    mComboBox = new QComboBox(false, page);
    mComboBox->insertStringList(identities);
    mComboBox->setEnabled(false);
    QLabel *label = new QLabel(mComboBox, i18n("&Existing identities:"), page);
    label->setEnabled(false);
    hlay->addWidget(label);
    hlay->addWidget(mComboBox, 1);

    vlay->addStretch(1);   // spacer

    // enable/disable combobox and label depending on the third radio
    // button's state:
    connect(radio, SIGNAL(toggled(bool)),
            label, SLOT(setEnabled(bool)));
    connect(radio, SIGNAL(toggled(bool)),
            mComboBox, SLOT(setEnabled(bool)));

    enableButtonOK(false);   // since line edit is empty
}
Esempio n. 8
0
void KexiNameDialog::slotTextChanged()
{
	bool enable = true;
	if (m_widget->isNameRequired() && m_widget->nameText().isEmpty()
		|| m_widget->isCaptionRequired() && m_widget->captionText().isEmpty())
		enable = false;
	enableButtonOK( enable );
}
Esempio n. 9
0
void SolvingRateDialog::slotOk()
{
    enableButtonOK(false);
    _i = 0;
    _success = 0;
    _progress->setValue(0);
    QTimer::singleShot(0, this, SLOT(step()));
}
Esempio n. 10
0
void NewWindowDialog::slotTextChanged( const QString &text)
{
  enableButtonOK( !text.isEmpty() );

  if(text[0] == "#" || text[0] == "&")
    m_le->setEnabled(true);
  else
    m_le->setEnabled(false);
}
Esempio n. 11
0
void NewIdentityDialog::slotEnableOK(const QString &proposedIdentityName)
{
    // OK button is disabled if
    QString name = proposedIdentityName.stripWhiteSpace();
    // name isn't empty
    if(name.isEmpty())
    {
        enableButtonOK(false);
        return;
    }
    // or name doesn't yet exist.
    for(int i = 0 ; i < mComboBox->count() ; i++)
        if(mComboBox->text(i) == name)
        {
            enableButtonOK(false);
            return;
        }
    enableButtonOK(true);
}
Esempio n. 12
0
void SolvingRateDialog::step()
{
    if ( _i==NB_STEPS ) {
        enableButtonOK(true);
        return;
    }
    _i++;
    _field.reset(_refField.width(), _refField.height(), _refField.nbMines());
    _solver.solve(_field, false);
}
Esempio n. 13
0
    void ServerListDialog::updateButtons()
    {
        int count = m_serverList->selectedItems().count();
        bool enable = (count > 0);

        enableButtonOK(enable);
        m_delButton->setEnabled(enable);

        enable = (count == 1);
        m_editButton->setEnabled(enable);
    }
Esempio n. 14
0
void NewProjectDlg::locationChanged( const QString & )
{
	m_location = m_pWidget->projectLocationURL->url();
	QDir subDir(m_location);
    
	if ( !m_location.endsWith("/") )
		m_location.append("/");
    
	if ( !m_pWidget->projectNameEdit->text().isEmpty() )
		m_location.append( m_pWidget->projectNameEdit->text().lower() + "/" );
    
	m_pWidget->locationLabel->setText( m_location );
    
	QDir dir(m_location);
	
	if ( dir.exists() || !subDir.exists() ) 
		enableButtonOK(false);
	
	else
		enableButtonOK(true);
}
NewProject::NewProject( QString prefix ) : KDialogBase( Plain,
			i18n( "Create New Project" ), Help | Ok | Cancel, Ok ) {
	QFrame* top = plainPage();

	QGridLayout* layoutGeneral = new QGridLayout( top, 2, 3, 5, 6 );

	int row = 0;
	QLabel* vobFilesLabel = new QLabel( i18n( "Vob or Sub files" ), top );
	vobFilesLabel->setAlignment( Qt::AlignTop );
	layoutGeneral->addWidget( vobFilesLabel, row, 0 );
	vobFilesList = new KListBox( top );
	layoutGeneral->addWidget( vobFilesList, row, 1 );

	QVBoxLayout* layoutFilesButton = new QVBoxLayout( 0, 0, 6 );
	KPushButton* vobFilesButton = new KPushButton ( top );
	layoutFilesButton->addWidget( vobFilesButton );
	layoutFilesButton->addItem( new QSpacerItem( 20, 40, QSizePolicy::Minimum,
								QSizePolicy::Expanding ) );
	layoutGeneral->addLayout( layoutFilesButton, row, 2 );

	++row;
	QLabel* dirLabel = new QLabel( i18n( "Directory" ), top );
	layoutGeneral->addWidget( dirLabel, row, 0 );

	dirEdit = new KLineEdit( top );
	dirEdit->setValidator( new DirValidator( dirEdit ) );
	dirEdit->setURLDropsEnabled( true );
	KURLCompletion* complet = new KURLCompletion( KURLCompletion::DirCompletion );
	dirEdit->setCompletionObject( complet );
	layoutGeneral->addWidget( dirEdit, row, 1 );

	KPushButton* dirButton = new KPushButton ( top );
	layoutGeneral->addWidget( dirButton, row, 2 );

	++row;
	QLabel* prefixLabel = new QLabel( i18n( "Prefix" ), top );
	layoutGeneral->addWidget( prefixLabel, row, 0 );
	prefixEdit = new KLineEdit( prefix, top );
	prefixEdit->setValidator( new QRegExpValidator( QRegExp( "\\S+" ), prefixEdit ) );
	layoutGeneral->addWidget( prefixEdit, row, 1 );

	enableButtonOK( false );
	vobFilesButton->setPixmap( KGlobal::iconLoader()->loadIcon( "fileopen", KIcon::Small ) );
	dirButton->setPixmap( KGlobal::iconLoader()->loadIcon( "fileopen", KIcon::Small ) );

	connect( vobFilesButton, SIGNAL( clicked() ), this, SLOT( selectVobs() ) );
	connect( dirButton, SIGNAL( clicked() ), this, SLOT( selectDir() ) );
	connect( prefixEdit, SIGNAL( textChanged( const QString& ) ),
			 this, SLOT( tryEnableButtonOk() ) );
	connect( dirEdit, SIGNAL( textChanged( const QString& ) ),
			 this, SLOT( tryEnableButtonOk() ) );
}
Esempio n. 16
0
void KGpgKeySelectionDlg::slotIdChanged(void)
{
    // this looks a bit awkward. Here's why: KGPGFile::keyAvailable() starts
    // an external task and processes UI events while it waits for the external
    // process to finish. Thus, the first time we get here, the external process
    // is started and the user may press a second key which calls this routine
    // again.
    //
    // The second invocation is counted, but the check is not started until the
    // first one finishes. Once the external process finishes, we check if we
    // were called in the meantime and restart the check.
    if(++m_checkCount == 1) {
        while(1) {
            // first we check the current edit field if filled
            bool keysOk = true;
            if(!m_listBox->currentText().isEmpty()) {
                keysOk = KGPGFile::keyAvailable(m_listBox->currentText());
            }

            // if it is available, then scan the current list if we need to
            if(keysOk) {
                if(m_needCheckList) {
                    QStringList keys = m_listBox->items();
                    QStringList::const_iterator it_s;
                    for(it_s = keys.begin(); keysOk && it_s != keys.end(); ++it_s) {
                        if(!KGPGFile::keyAvailable(*it_s))
                            keysOk = false;
                    }
                    m_listOk = keysOk;
                    m_needCheckList = false;

                } else {
                    keysOk = m_listOk;
                }
            }

            // did we receive some more requests to check?
            if(m_checkCount > 1) {
                m_checkCount = 1;
                continue;
            }

            m_keyLed->setState(static_cast<KLed::State>(keysOk && (m_listBox->items().count() != 0) ? KLed::On : KLed::Off));
            enableButtonOK((m_listBox->items().count() == 0) || (m_keyLed->state() == KLed::On));
            break;
        }

        --m_checkCount;
    }
}
Esempio n. 17
0
PMObjectSelect::PMObjectSelect( QWidget* parent, const char* name, bool modal )
      : KDialogBase( parent, name, modal, i18n( "Choose Object" ), Ok | Cancel )
{
   m_pSelectedObject = 0;
   m_pListBox = new QListBox( this );
   setMainWidget( m_pListBox );
   setInitialSize( s_size );

   connect( m_pListBox, SIGNAL( highlighted( QListBoxItem* ) ),
            SLOT( slotHighlighted( QListBoxItem* ) ) );
   connect( m_pListBox, SIGNAL( selected( QListBoxItem* ) ),
            SLOT( slotSelected( QListBoxItem* ) ) );
   enableButtonOK( false );
}
Esempio n. 18
0
MainDialog::MainDialog( QWidget *parent, const char *name )
    : KDialogBase( parent, name, true, i18n( "Remote Desktop Connection" ),
      Ok|Close|Help|User1, Ok, true, KGuiItem( i18n( "&Preferences" ),
      "configure" ) )
{
  m_dialogWidget = new MainDialogWidget( this, "m_dialogWidget" );
  setMainWidget( m_dialogWidget );

  setButtonText( Ok, i18n( "Connect" ) );
  enableButtonOK( false );

  connect( m_dialogWidget, SIGNAL( hostValid( bool ) ),
                           SLOT( enableButtonOK( bool ) ) );
}
Esempio n. 19
0
void KLineEditDlg::slotTextChanged(const QString &text)
{
    bool on;
    if ( edit->validator() ) {
        QString str = edit->text();
        int index = edit->cursorPosition();
        on = ( edit->validator()->validate( str, index )
               == QValidator::Acceptable );
    } else {
        on = !text.isEmpty();
    }
    enableButtonOK( on );
    enableButton(KDialogBase::User1, text.length());
}
Esempio n. 20
0
PolicyDlg::PolicyDlg(const QString &caption, QWidget *parent, const char *name) : KDialogBase(parent, name, true, caption, Ok | Cancel, Ok, true)
{
    m_dlgUI = new PolicyDlgUI(this);
    setMainWidget(m_dlgUI);

    m_dlgUI->leDomain->setValidator(new DomainLineValidator(m_dlgUI->leDomain));
    m_dlgUI->cbPolicy->setMinimumWidth(m_dlgUI->cbPolicy->fontMetrics().maxWidth() * 25);

    enableButtonOK(false);
    connect(m_dlgUI->leDomain, SIGNAL(textChanged(const QString &)), SLOT(slotTextChanged(const QString &)));

    setFixedSize(sizeHint());
    m_dlgUI->leDomain->setFocus();
}
Esempio n. 21
0
ValgrindDialog::ValgrindDialog( Type type, QWidget* parent )
  : KDialogBase( parent, "valgrind dialog", true, i18n("Valgrind Memory Check"), Ok|Cancel ),
  m_type(type)
{
  w = new DialogWidget( this );
  w->valExecutableEdit->setURL( "valgrind" );
  w->executableEdit->setFocus();
  w->stack->raiseWidget(m_type);
  setMainWidget( w );
  connect( w->executableEdit->lineEdit(),  SIGNAL( textChanged( const QString &)), this, SLOT( valgrindTextChanged()));
  connect( w->valExecutableEdit->lineEdit(), SIGNAL( textChanged( const QString &)), this, SLOT( valgrindTextChanged()));
  connect( w->ctExecutableEdit->lineEdit(),  SIGNAL( textChanged( const QString &)), this, SLOT( valgrindTextChanged()));
  connect( w->kcExecutableEdit->lineEdit(), SIGNAL( textChanged( const QString &)), this, SLOT( valgrindTextChanged()));
  enableButtonOK( false );
}
Esempio n. 22
0
NewLanguageDialog::NewLanguageDialog(LanguageItemList &suppressedLangs,
                                     QWidget *parent, const char *name,
                                     bool modal)
    : KDialogBase(parent, name, modal, i18n("New Language"), Ok | Cancel, Ok, true)
{
    // layout the page (a combobox with label):
    QWidget *page = makeMainWidget();
    QHBoxLayout *hlay = new QHBoxLayout(page, 0, spacingHint());
    mComboBox = new QComboBox(false, page);
    hlay->addWidget(new QLabel(mComboBox, i18n("Choose &language:"), page));
    hlay->addWidget(mComboBox, 1);

    QStringList pathList = KGlobal::dirs()->findAllResources("locale",
                           QString::fromLatin1("*/entry.desktop"));
    // extract a list of language tags that should not be included:
    QStringList suppressedAcronyms;
    for(LanguageItemList::Iterator lit = suppressedLangs.begin();
            lit != suppressedLangs.end(); ++lit)
        suppressedAcronyms << (*lit).mLanguage;

    // populate the combo box:
    for(QStringList::ConstIterator it = pathList.begin();
            it != pathList.end(); ++it)
    {
        KSimpleConfig entry(*it);
        entry.setGroup("KCM Locale");
        // full name:
        QString name = entry.readEntry("Name");
        // {2,3}-letter abbreviation:
        // we extract it from the path: "/prefix/de/entry.desktop" -> "de"
        QString acronym = (*it).section('/', -2, -2);

        if(suppressedAcronyms.find(acronym) == suppressedAcronyms.end())
        {
            // not found:
            QString displayname = QString::fromLatin1("%1 (%2)")
                                  .arg(name).arg(acronym);
            QPixmap flag(locate("locale", acronym + flagPng));
            mComboBox->insertItem(flag, displayname);
        }
    }
    if(!mComboBox->count())
    {
        mComboBox->insertItem(i18n("No More Languages Available"));
        enableButtonOK(false);
    }
    else mComboBox->listBox()->sort();
}
Esempio n. 23
0
void KWatchGnuPGConfig::saveConfig()
{
    KConfig *config = kapp->config();
    config->setGroup("WatchGnuPG");
    config->writeEntry("Executable", mExeED->url());
    config->writeEntry("Socket", mSocketED->url());
    config->writeEntry("LogLevel", log_levels[mLogLevelCB->currentItem()]);

    config->setGroup("LogWindow");
    config->writeEntry("MaxLogLen", mLoglenSB->value());
    config->writeEntry("WordWrap", mWordWrapCB->isChecked());

    config->setGroup(QString::null);
    config->sync();
    enableButtonOK(false);
    enableButtonApply(false);
}
Esempio n. 24
0
void KWatchGnuPGConfig::loadConfig()
{
    KConfig *config = kapp->config();
    config->setGroup("WatchGnuPG");
    mExeED->setURL(config->readEntry("Executable", "watchgnupg"));
    mSocketED->setURL(config->readEntry("Socket", QDir::home().canonicalPath()
                                        + "/.gnupg/log-socket"));
    mLogLevelCB->setCurrentItem(log_level_to_int(config->readEntry("LogLevel", "basic")));

    config->setGroup("LogWindow");
    mLoglenSB->setValue(config->readNumEntry("MaxLogLen", 10000));
    mWordWrapCB->setChecked(config->readBoolEntry("WordWrap", false));

    config->setGroup(QString::null);
    enableButtonOK(false);
    enableButtonApply(false);
}
Esempio n. 25
0
void PodcastSettingsDialog::slotOk()       //slot
{
    enableButtonOK( false ); //visual feedback

    m_settings->m_saveLocation     = requesterSaveLocation();
    m_settings->m_autoScan         = m_ps->m_autoFetchCheck->isChecked();
    m_settings->m_addToMediaDevice = m_ps->m_addToMediaDeviceCheck->isChecked();
    m_settings->m_purge            = m_ps->m_purgeCheck->isChecked();
    m_settings->m_purgeCount       = m_ps->m_purgeCountSpinBox->value();

    if( m_ps->m_streamRadio->isChecked() )
        m_settings->m_fetch = STREAM;
    else
        m_settings->m_fetch = AUTOMATIC;

    KDialogBase::slotOk();
}
Esempio n. 26
0
void KexiNameDialog::init()
{
	QGridLayout *lyr = new QGridLayout(plainPage(), 2, 3);
	m_icon = new QLabel( plainPage(), "icon" );
	m_icon->setAlignment( int( AlignTop | AlignLeft ) );
	m_icon->setSizePolicy(QSizePolicy(QSizePolicy::Fixed, QSizePolicy::Preferred,1,0));
	m_icon->setFixedWidth(50);
	lyr->addWidget(m_icon,0,0);

	m_widget->setSizePolicy(QSizePolicy(QSizePolicy::Expanding, QSizePolicy::Preferred,1,0));
	lyr->addWidget(m_widget,0,1);
	lyr->addItem(new QSpacerItem( 25, 10, QSizePolicy::Expanding, QSizePolicy::Minimum ), 0, 2);
	lyr->addItem(new QSpacerItem( 5, 10, QSizePolicy::Minimum, QSizePolicy::Expanding ), 1, 1);
//	m_widget->captionLineEdit()->selectAll();
//	m_widget->captionLineEdit()->setFocus();
	connect(m_widget,SIGNAL(messageChanged()),this, SLOT(updateSize()));
	updateSize();
	enableButtonOK( true );
	slotTextChanged();
	connect(m_widget, SIGNAL(textChanged()), this, SLOT(slotTextChanged()));
}
KSUpgradeManager::KSUpgradeManager(QWidget *parent, const QString &caption)
  : KDialogBase(parent, "KSDownloadManager", true, caption, Ok|Cancel), m_completedDownloads(0)
{
  KIO::CopyJob *copy;

  //Setting up the basics...
  setButtonText(ButtonCode(Ok), i18n("Upgrade"));
  setButtonText(ButtonCode(Cancel), i18n("Close"));
  enableButtonOK(false);

  m_mainWidget = new KSUpgradeManagerWdt(this);
  setMainWidget(m_mainWidget);
  m_mainWidget->downloadList->addColumn(i18n("File"));

  //Download versioning files...
  m_mainWidget->currentLabel->setText(i18n("Version files"));
  copy = KIO::copy(KURL("http://kslovar.berlios.de/version"), KURL("/tmp/version"), false);
  connect(copy, SIGNAL(result(KIO::Job*)), this, SLOT(slotCheckVersion()));
  connect(copy, SIGNAL(percent(KIO::Job*, unsigned long)), this, SLOT(slotProgress(KIO::Job*, unsigned long)));
  copy->setInteractive(false);
}
void KSUpgradeManager::slotCheckVersion()
{
  QString localVersion = "000", remoteVersion = "000";
  QString versionFile = locateLocal("appdata", "version");
  QString languageFile = locateLocal("appdata", "languages.ksl", false);

  QFile local(versionFile);
  if(local.exists())
  {
    local.open(IO_ReadOnly);
    QString input;
    local.readLine(input, 5);
    localVersion = input;
    local.close();
  }

  QFile remote("/tmp/version");
  if(remote.exists())
  {
    remote.open(IO_ReadOnly);
    QString input;
    remote.readLine(input, 5);
    remoteVersion = input;
    remote.close();
  }

  if(remoteVersion > localVersion)
  {
    new KListViewItem(m_mainWidget->downloadList, "Languages.ksl", languageFile, "http://kslovar.berlios.de/languages.ksl");
    enableButtonOK(true);
    m_mainWidget->currentLabel->setText(i18n("nothing"));
  }
  else
  {
    KSlovar::KSInstance()->loadLanguages();
    close();
  }
}
Esempio n. 29
0
void
PodcastSettingsDialog::init()
{
        m_ps = new PodcastSettingsDialogBase(this);

        KWin::setState( winId(), NET::SkipTaskbar );

        setMainWidget(m_ps);
        m_ps->m_saveLocation->setMode( KFile::Directory | KFile::ExistingOnly );

        m_ps->m_addToMediaDeviceCheck->setEnabled( MediaBrowser::isAvailable() );

        enableButtonOK( false );

         // Connects for modification check
        connect( m_ps->m_purgeCountSpinBox->child( "qt_spinbox_edit" ),  SIGNAL(textChanged( const QString& )), SLOT(checkModified()) );
        connect( m_ps->m_saveLocation,   SIGNAL(textChanged( const QString& )), SLOT(checkModified()) );
        connect( m_ps->m_autoFetchCheck, SIGNAL(clicked()),                     SLOT(checkModified()) );
        connect( m_ps->m_streamRadio,    SIGNAL(clicked()),                     SLOT(checkModified()) );
        connect( m_ps->m_addToMediaDeviceCheck, SIGNAL(clicked()),              SLOT(checkModified()) );
        connect( m_ps->m_downloadRadio,  SIGNAL(clicked()),                     SLOT(checkModified()) );
        connect( m_ps->m_purgeCheck,     SIGNAL(clicked()),                     SLOT(checkModified()) );
}
Esempio n. 30
0
void KURLRequesterDlg::initDialog(const TQString &text,const TQString &urlName)
{
   TQVBoxLayout * topLayout = new TQVBoxLayout( plainPage(), 0,
            spacingHint() );

    TQLabel * label = new TQLabel( text , plainPage() );
    topLayout->addWidget( label );

    urlRequester_ = new KURLRequester( urlName, plainPage(), "urlRequester" );
    urlRequester_->setMinimumWidth( urlRequester_->sizeHint().width() * 3 );
    topLayout->addWidget( urlRequester_ );
    urlRequester_->setFocus();
    connect( urlRequester_->lineEdit(), TQT_SIGNAL(textChanged(const TQString&)),
             TQT_SLOT(slotTextChanged(const TQString&)) );
    bool state = !urlName.isEmpty();
    enableButtonOK( state );
    enableButton( KDialogBase::User1, state );
    /*
    KFile::Mode mode = static_cast<KFile::Mode>( KFile::File |
            KFile::ExistingOnly );
	urlRequester_->setMode( mode );
    */
    connect( this, TQT_SIGNAL( user1Clicked() ), TQT_SLOT( slotClear() ) );
}