Esempio n. 1
0
void KNewFileMenuPrivate::executeOtherDesktopFile(const KNewFileMenuSingleton::Entry& entry)
{
    if (!checkSourceExists(entry.templatePath)) {
        return;
    }

    KUrl::List::const_iterator it = m_popupFiles.constBegin();
    for (; it != m_popupFiles.constEnd(); ++it)
    {
        QString text = entry.text;
        text.remove("..."); // the ... is fine for the menu item but not for the default filename
        text = text.trimmed(); // In some languages, there is a space in front of "...", see bug 268895
        // KDE5 TODO: remove the "..." from link*.desktop files and use i18n("%1...") when making
        // the action.

        KUrl defaultFile(*it);
        defaultFile.addPath(KIO::encodeFileName(text));
        if (defaultFile.isLocalFile() && QFile::exists(defaultFile.toLocalFile()))
            text = KIO::RenameDialog::suggestName(*it, text);

        const KUrl templateUrl(entry.templatePath);
	
	KDialog* dlg = new KPropertiesDialog(templateUrl, *it, text, m_parentWidget);
	dlg->setModal(q->isModal());
	dlg->setAttribute(Qt::WA_DeleteOnClose);
        QObject::connect(dlg, SIGNAL(applied()), q, SLOT(_k_slotOtherDesktopFile()));
	dlg->show();
    }
    // We don't set m_src here -> there will be no copy, we are done.
}
void ConfigurationDialog::showDmesg()
{
	KDialog *dialog = new DmesgDialog(this);
	dialog->setAttribute(Qt::WA_DeleteOnClose, true);
	dialog->setModal(true);
	dialog->show();
}
Esempio n. 3
0
int main(int argc, char *argv[])
{
    KAboutData aboutData("itemview-test", 0, ki18n("test for item view"),
                         "0.1", ki18n("test app"),
                         KAboutData::License_GPL,
                         ki18n("(c) 2008 Alessandro Diaferia"),
                         KLocalizedString(), "", "*****@*****.**");
    aboutData.addAuthor(ki18n("Alessandro Diaferia"), KLocalizedString(), "*****@*****.**");

    KCmdLineArgs::init(argc, argv, &aboutData);

    KCmdLineOptions options;
    KCmdLineArgs::addCmdLineOptions(options);
    KCmdLineArgs::parsedArgs();
    KApplication app;

    KDialog *window = new KDialog();
    RaptorItemsView *itemsView = new RaptorItemsView(window);
    Kickoff::ApplicationModel *model = new Kickoff::ApplicationModel();
    itemsView->setModel(model);
    RaptorItemDelegate *delegate = new RaptorItemDelegate();
    itemsView->setItemDelegate(delegate);

    window->setMainWidget(itemsView);

    window->show();

   return app.exec();
    
}
int main( int argc, char **argv )
{
	KCmdLineArgs::init( argc, argv, "klistviewtest", 0, ki18n("K3ListViewTest"), "1.0", ki18n("klistview test app"));
	KApplication app;
	KDialog dialog;
	K3ListView *view = new K3ListView();
  dialog.setMainWidget(view);
	view->setSelectionModeExt( K3ListView::FileManager );
	view->setDragEnabled( true );
	view->setItemsMovable( false );
	view->setAcceptDrops( true );
	view->addColumn("Column 1");
	view->addColumn("Column 2");
	view->addColumn("Column 3");

	new K3ListViewItem( view, "Item 1");
	new K3ListViewItem( view, "Item 1");
	new K3ListViewItem( view, "Item 1");
	new K3ListViewItem( view, "Item 1");
	new K3ListViewItem( view, "Item 1");
	new K3ListViewItem( view, "Item 1");
	new K3ListViewItem( view, "Item 1");
	new K3ListViewItem( view, "Item 1");
	new K3ListViewItem( view, "Item 1");
	new K3ListViewItem( view, "Item 2", "Some more", "Hi Mom :)" );

	view->restoreLayout( KGlobal::config().data(), "ListView" );

	new K3ListViewItem( view, "Item 3" );

	dialog.exec();
	view->saveLayout( KGlobal::config().data(), "ListView" );

	return 0;
}
Esempio n. 5
0
KoFilter::ConversionStatus
PngExport::convert( const QByteArray& from, const QByteArray& to )
{
    if ( to != "image/png" || from != "application/vnd.oasis.opendocument.graphics" )
    {
        return KoFilter::NotImplemented;
    }

    KoDocument * document = m_chain->inputDocument();
    if( ! document )
        return KoFilter::ParsingError;

    KarbonPart * karbonPart = dynamic_cast<KarbonPart*>( document );
    if( ! karbonPart )
        return KoFilter::WrongFormat;

    KoShapePainter painter;
    painter.setShapes( karbonPart->document().shapes() );

    // get the bounding rect of the content
    QRectF shapesRect = painter.contentRect();
    // get the size on point
    QSizeF pointSize = shapesRect.size();
    // get the size in pixel (100% zoom)
    KoZoomHandler zoomHandler;
    QSize pixelSize = zoomHandler.documentToView( pointSize ).toSize();
    QColor backgroundColor( Qt::white );

    if( ! m_chain->manager()->getBatchMode() )
    {
        PngExportOptionsWidget * widget = new PngExportOptionsWidget( pointSize );
        widget->setUnit( karbonPart->unit() );
        widget->setBackgroundColor( backgroundColor );

        KDialog dlg;
        dlg.setCaption( i18n("PNG Export Options") );
        dlg.setButtons( KDialog::Ok | KDialog::Cancel );
        dlg.setMainWidget( widget );
        if( dlg.exec() != QDialog::Accepted )
            return KoFilter::UserCancelled;

        pixelSize = widget->pixelSize();
        backgroundColor = widget->backgroundColor();
    }
    QImage image( pixelSize, QImage::Format_ARGB32 );

    // draw the background of the image
    image.fill( backgroundColor.rgba() );

    // paint the shapes
    if( ! painter.paintShapes( image ) )
        return KoFilter::CreationError;

    image.save( m_chain->outputFile(), "PNG" );

    return KoFilter::OK;
}
void TaskWidgetItem::TaskWidgetItem::editTask()
{

    qDebug() << (int)parentWidget()->geometry().width();
    
    m_editor = new TaskEditor();

    m_editor->setAllDay(m_todo->allDay());

    if (m_todo->hasStartDate()) {

        m_editor->setStartDate(m_todo->dtStart());

    } else {

        m_editor->disableStartDate();

        if (m_todo->hasDueDate()) {

            if (m_todo->dtDue().date() < QDate::currentDate()) {

                m_editor->setStartDate(m_todo->dtDue());

            }

        }

    }

    if (m_todo->hasDueDate()) {

        m_editor->setDueDate(m_todo->dtDue());

    } else {

        m_editor->disableDueDate();

    }

    m_editor->setName(m_todo->summary());
    m_editor->setDescription(m_todo->description());

    KDialog * dialog = new KDialog();
    dialog->setCaption(m_todo->summary());
    dialog->setButtons(KDialog::Ok | KDialog::Cancel);

    dialog->setMainWidget(m_editor);

    connect(dialog, SIGNAL(okClicked()), SLOT(saveTask()));

    connect(dialog, SIGNAL(okClicked()), dialog, SLOT(delayedDestruct()));
    connect(dialog, SIGNAL(cancelClicked()), dialog, SLOT(delayedDestruct()));

    dialog->show();

}
Esempio n. 7
0
bool KNewFileMenuPrivate::checkSourceExists(const QString& src)
{
    if (!QFile::exists(src)) {
        kWarning(1203) << src << "doesn't exist" ;
	
	KDialog* dialog = new KDialog(m_parentWidget);
	dialog->setCaption( i18n("Sorry") );
	dialog->setButtons( KDialog::Ok );
	dialog->setObjectName( "sorry" );
	dialog->setModal(q->isModal());
	dialog->setAttribute(Qt::WA_DeleteOnClose);
	dialog->setDefaultButton( KDialog::Ok );
	dialog->setEscapeButton( KDialog::Ok );
	
	KMessageBox::createKMessageBox(dialog, QMessageBox::Warning, 
	  i18n("<qt>The template file <b>%1</b> does not exist.</qt>", src), 
	  QStringList(), QString(), 0, KMessageBox::NoExec,
	  QString());
	
	dialog->show();
	
        return false;
    }
    return true;
}
Esempio n. 8
0
void ExtendedAboutDialog::Private::_k_showLicense( const QString &number )
{
    KDialog *dialog = new KDialog(q);

    dialog->setCaption(i18n("License Agreement"));
    dialog->setButtons(KDialog::Close);
    dialog->setDefaultButton(KDialog::Close);

    const QFont font = KGlobalSettings::fixedFont();
    QFontMetrics metrics(font);

    const QString licenseText = aboutData->licenses().at(number.toInt()).text();
    KTextBrowser *licenseBrowser = new KTextBrowser;
    licenseBrowser->setFont(font);
    licenseBrowser->setLineWrapMode(QTextEdit::NoWrap);
    licenseBrowser->setText(licenseText);

    dialog->setMainWidget(licenseBrowser);

    // try to set up the dialog such that the full width of the
    // document is visible without horizontal scroll-bars being required
    const qreal idealWidth = licenseBrowser->document()->idealWidth() + (2 * dialog->marginHint())
        + licenseBrowser->verticalScrollBar()->width() * 2;

    // try to allow enough height for a reasonable number of lines to be shown
    const int idealHeight = metrics.height() * 30;

    dialog->setInitialSize(dialog->sizeHint().expandedTo(QSize((int)idealWidth,idealHeight)));
    dialog->show();
}
void DebuggerManager::slotProfile()
{
  if(m_debugger)
  {
    KDialog* d = m_debugger->profileDialog();
    if(d) {
      d->show();
      m_debugger->profile();
    }
  }
}
Esempio n. 10
0
QWidget* ContactsSource::configurationInterface()
{
    if (!d->confDialog) {
        KDialog *di = new KDialog;
        QWidget *in = FunambolSyncSource::configurationInterface();
//         QHBoxLayout *l = new QHBoxLayout;
//         in->show();
//         l->addWidget(in);
        di->setMainWidget(in);
        d->confDialog = di;
    }
    return d->confDialog;
}
// new groups
void KNGroupDialog::slotUser2()
{
  QDate lastDate = a_ccount->lastNewFetch();
  KDialog *dlg = new KDialog( this );
  dlg->setCaption( i18n("New Groups") );
  dlg->setButtons( Ok | Cancel );

  QGroupBox *btnGrp = new QGroupBox( i18n("Check for New Groups"), dlg );
  dlg->setMainWidget(btnGrp);
  QGridLayout *topL = new QGridLayout( btnGrp );

  QRadioButton *takeLast = new QRadioButton( i18n("Created since last check:"), btnGrp );
  topL->addWidget(takeLast, 0, 0, 1, 2 );

  QLabel *l = new QLabel(KGlobal::locale()->formatDate(lastDate, KLocale::LongDate),btnGrp);
  topL->addWidget(l, 1, 1, Qt::AlignLeft);

  connect(takeLast, SIGNAL(toggled(bool)), l, SLOT(setEnabled(bool)));

  QRadioButton *takeCustom = new QRadioButton( i18n("Created since this date:"), btnGrp );
  topL->addWidget(takeCustom, 2, 0, 1, 2 );

  dateSel = new KDatePicker( lastDate, btnGrp );
  dateSel->setMinimumSize(dateSel->sizeHint());
  topL->addWidget(dateSel, 3, 1, Qt::AlignLeft);

  connect(takeCustom, SIGNAL(toggled(bool)), this, SLOT(slotDatePickerEnabled(bool)));

  takeLast->setChecked(true);
  dateSel->setEnabled(false);

  topL->addItem( new QSpacerItem(30, 0 ), 0, 0 );

  if (dlg->exec()) {
    if (takeCustom->isChecked())
      lastDate = dateSel->date();
    a_ccount->setLastNewFetch(QDate::currentDate());
    leftLabel->setText(i18n("Checking for new groups..."));
    enableButton(User1,false);
    enableButton(User2,false);
    filterEdit->clear();
    subCB->setChecked(false);
    newCB->setChecked(true);
    emit(checkNew(a_ccount,lastDate));
    incrementalFilter=false;
    slotRefilter();
  }

  delete dlg;
}
Esempio n. 12
0
void RKCaughtX11Window::copyDeviceToRObject () {
	RK_TRACE (MISC);

// TODO: not very pretty, yet
	KDialog *dialog = new KDialog (this);
	dialog->setButtons (KDialog::Ok|KDialog::Cancel);
	dialog->setCaption (i18n ("Specify R object"));
	dialog->setModal (true);
	KVBox *page = new KVBox (dialog);
	dialog->setMainWidget (page);

	new QLabel (i18n ("Specify the R object name, you want to save the graph to"), page);
	RKSaveObjectChooser *chooser = new RKSaveObjectChooser (page, "my.plot");
	connect (chooser, SIGNAL (changed(bool)), dialog, SLOT (enableButtonOk(bool)));
	if (!chooser->isOk ()) dialog->enableButtonOk (false);

	dialog->exec ();

	if (dialog->result () == QDialog::Accepted) {
		RK_ASSERT (chooser->isOk ());

		QString name = chooser->currentFullName ();

		RKGlobals::rInterface ()->issueCommand ("dev.set (" + QString::number (device_number) + ")\n" + name + " <- recordPlot ()", RCommand::App | RCommand::ObjectListUpdate, i18n ("Save contents of graphics device number %1 to object '%2'", device_number, name), error_dialog);
	}

	delete dialog;
}
Esempio n. 13
0
void EditProfileDialog::showKeyBindingEditor(bool isNewTranslator)
{
    QModelIndexList selected = _ui->keyBindingList->selectionModel()->selectedIndexes();
    QAbstractItemModel* model = _ui->keyBindingList->model();

    const KeyboardTranslator* translator = 0;
    if ( !selected.isEmpty() )
        translator = model->data(selected.first(),Qt::UserRole+1).value<const KeyboardTranslator*>();
    else
        translator = KeyboardTranslatorManager::instance()->defaultTranslator();

    Q_ASSERT(translator);

    KDialog* dialog = new KDialog(this);

    if ( isNewTranslator )
        dialog->setCaption(i18n("New Key Binding List"));
    else
        dialog->setCaption(i18n("Edit Key Binding List"));

    KeyBindingEditor* editor = new KeyBindingEditor;
    dialog->setMainWidget(editor);
    
    if ( translator )
        editor->setup(translator);

    if ( isNewTranslator )
        editor->setDescription(i18n("New Key Binding List"));

    if ( dialog->exec() == QDialog::Accepted )
    {
        KeyboardTranslator* newTranslator = new KeyboardTranslator(*editor->translator());

        if ( isNewTranslator )
            newTranslator->setName(newTranslator->description());

        KeyboardTranslatorManager::instance()->addTranslator( newTranslator );

        updateKeyBindingsList();
        
        const QString& currentTranslator = lookupProfile()
                                        ->property<QString>(Profile::KeyBindings);

        if ( newTranslator->name() == currentTranslator )
        {
            _tempProfile->setProperty(Profile::KeyBindings,newTranslator->name());
        }
    }
}
Esempio n. 14
0
void MainWindow::errorOccurred(const QString &message)
{
    QString completeMessage = i18n("Installation failed! The following error has been reported: %1.\n"
                                   "Tribe will now quit, please check the installation logs in /tmp\n"
                                   "or ask for help in our forums.", message);

    KDialog *dialog = new KDialog(this, Qt::FramelessWindowHint);
    dialog->setButtons(KDialog::Ok);
    dialog->setModal(true);
    bool retbool;

    KMessageBox::createKMessageBox(dialog, QMessageBox::Warning, completeMessage,
                                   QStringList(), QString(), &retbool, KMessageBox::Notify);

    quitToChakra();
}
Esempio n. 15
0
void Klipper::slotShowBarcode()
{
    using namespace prison;
    const HistoryStringItem* item = dynamic_cast<const HistoryStringItem*>(m_history->first());

    KDialog dlg;
    dlg.setModal( true );
    dlg.setCaption( i18n("Mobile Barcode") );
    dlg.setButtons( KDialog::Ok );

    QWidget* mw = new QWidget(&dlg);
    QHBoxLayout* layout = new QHBoxLayout(mw);

    BarcodeWidget* qrcode = new BarcodeWidget(new QRCodeBarcode());
    BarcodeWidget* datamatrix = new BarcodeWidget(new DataMatrixBarcode());

    if (item) {
        qrcode->setData( item->text() );
        datamatrix->setData( item->text() );
    }

    layout->addWidget(qrcode);
    layout->addWidget(datamatrix);

    mw->setFocus();
    dlg.setMainWidget( mw );
    dlg.adjustSize();

    dlg.exec();
}
Esempio n. 16
0
void RKCaughtX11Window::setFixedSizeManual () {
	RK_TRACE (MISC);

// TODO: not very pretty, yet
	KDialog *dialog = new KDialog (this);
	dialog->setButtons (KDialog::Ok|KDialog::Cancel);
	dialog->setCaption (i18n ("Specify fixed size"));
	dialog->setModal (true);

	KVBox *page = new KVBox (dialog);
	dialog->setMainWidget (page);

	new QLabel (i18n ("Width"), page);
	KIntSpinBox *width = new KIntSpinBox (5, 32767, 1, xembed_container->width (), page, 10);
	width->setEditFocus (true);

	new QLabel (i18n ("Height"), page);
	KIntSpinBox *height = new KIntSpinBox (5, 32767, 1, xembed_container->height (), page, 10);

	dialog->exec ();

	if (dialog->result () == QDialog::Accepted) {
		dynamic_size_action->setChecked (false);
		fixedSizeToggled ();		// see setFixedSize1 () above

		xembed_container->setFixedSize (width->value (), height->value ());
	}

	delete dialog;
}
Esempio n. 17
0
void Klipper::slotEditData()
{
    const HistoryStringItem* item = dynamic_cast<const HistoryStringItem*>(m_history->first());

    KDialog dlg;
    dlg.setModal( true );
    dlg.setCaption( i18n("Edit Contents") );
    dlg.setButtons( KDialog::Ok | KDialog::Cancel );

    KTextEdit *edit = new KTextEdit( &dlg );
    if (item) {
        edit->setText( item->text() );
    }
    edit->setFocus();
    edit->setMinimumSize( 300, 40 );
    dlg.setMainWidget( edit );
    dlg.adjustSize();

    if ( dlg.exec() == KDialog::Accepted ) {
        QString text = edit->toPlainText();
        if (item) {
            m_history->remove( item );
        }
        m_history->insert( new HistoryStringItem(text) );
        if (m_myURLGrabber) {
            m_myURLGrabber->checkNewData( m_history->first() );
        }
    }

}
Esempio n. 18
0
int RecurrenceActions::questionSelectedAllCancel( const QString &message, const QString &caption,
                                                  const KGuiItem &actionSelected,
                                                  const KGuiItem &actionAll, QWidget *parent )
{
  KDialog *dialog = new KDialog( parent );
  dialog->setCaption( caption );
  dialog->setButtons( KDialog::Yes | KDialog::Ok | KDialog::Cancel );
  dialog->setObjectName( "RecurrenceActions::questionSelectedAllCancel" );
  dialog->setDefaultButton( KDialog::Yes );
  dialog->setButtonGuiItem( KDialog::Yes, actionSelected );
  dialog->setButtonGuiItem( KDialog::Ok, actionAll );

  bool checkboxResult = false;
  int result = KMessageBox::createKMessageBox(
    dialog,
    QMessageBox::Question,
    message,
    QStringList(),
    QString(),
    &checkboxResult,
    KMessageBox::Notify );

  switch (result) {
    case KDialog::Yes:
      return SelectedOccurrence;
    case QDialog::Accepted:
      // See kdialog.h, 'Ok' doesn't return KDialog:Ok
      return AllOccurrences;
    default:
      return NoOccurrence;
  }

  return NoOccurrence;
}
Esempio n. 19
0
void KNewFileMenuPrivate::confirmCreatingHiddenDir(const QString& name)
{
    if(!KMessageBox::shouldBeShownContinue("confirm_create_hidden_dir")){
	_k_slotCreateHiddenDirectory();
	return;
    }
  
    KGuiItem continueGuiItem(KStandardGuiItem::cont());
    continueGuiItem.setText(i18nc("@action:button", "Create directory"));
    KGuiItem cancelGuiItem(KStandardGuiItem::cancel());
    cancelGuiItem.setText(i18nc("@action:button", "Enter a different name"));
    
    KDialog* confirmDialog = new KDialog(m_parentWidget);
    confirmDialog->setCaption(i18n("Create hidden directory?"));
    confirmDialog->setModal(m_modal);
    confirmDialog->setAttribute(Qt::WA_DeleteOnClose);
    KMessageBox::createKMessageBox(confirmDialog, QMessageBox::Warning, 
	  i18n("The name \"%1\" starts with a dot, so the directory will be hidden by default.", name),
	  QStringList(),
	  i18n("Do not ask again"),
	  0,
	  KMessageBox::NoExec,
	  QString());
    confirmDialog->setButtonGuiItem(KDialog::Ok, continueGuiItem);
    confirmDialog->setButtonGuiItem(KDialog::Cancel, cancelGuiItem);
    
    QObject::connect(confirmDialog, SIGNAL(accepted()), q, SLOT(_k_slotCreateHiddenDirectory()));
    QObject::connect(confirmDialog, SIGNAL(rejected()), q, SLOT(createDirectory()));
    
    m_fileDialog = confirmDialog;
    confirmDialog->show();
    
}
Esempio n. 20
0
void MainWindow::abortInstallation()
{
    QString msg;

    msg.append(i18n("Do you really want to abort the installation?"));

    KDialog *dialog = new KDialog(this, Qt::FramelessWindowHint);
    bool retbool = true;
    dialog->setButtons(KDialog::Yes | KDialog::No);

    if (KMessageBox::createKMessageBox(dialog, KIcon("dialog-warning"), msg, QStringList(),
                                       QString(), &retbool, KMessageBox::Notify) == KDialog::Yes) {
        setUpCleanupPage();

        InstallationHandler::instance()->abortInstallation();

        qApp->exit(0);
    }
}
void Wireless80211Widget::scanClicked()
{
    Q_D(Wireless80211Widget);
    KDialog scanDialog;
    scanDialog.setCaption(i18nc("@title:window wireless network scan dialog",
                "Available Networks"));
    scanDialog.setButtons( KDialog::Ok | KDialog::Cancel);
    ScanWidget scanWid;
    scanDialog.setMainWidget(&scanWid);
    connect(&scanWid,SIGNAL(doubleClicked()),&scanDialog,SLOT(accept()));
    if (scanDialog.exec() == QDialog::Accepted) {
        QPair<QString,QString> accessPoint = scanWid.currentAccessPoint();
        d->ui.ssid->setText(accessPoint.first);
        d->ui.bssid->setText(accessPoint.second);
        const QPair<Solid::Control::WirelessNetworkInterfaceNm09 *, Solid::Control::AccessPointNm09 *> pair = scanWid.currentAccessPointUni();
        emit ssidSelected(pair.first, pair.second);
        setAccessPointData(pair.first, pair.second);
    }
}
Esempio n. 22
0
void NotifyCollection::displayCollection( QWidget *p ) const
{
  //KMessageBox::information(p,collection(),i18n("Collected Notes"));
  KDialog *dlg = new KDialog( p );
  dlg->setCaption( i18n( "Collected Notes" ) );
  dlg->setButtons( KDialog::Close );
  dlg->setDefaultButton( KDialog::Close );
  dlg->setModal( false );
  KTextEdit *text = new KTextEdit( dlg );
  text->setReadOnly( true );
  text->setText( collection() );
  dlg->setMainWidget( text );
  dlg->setMinimumWidth( 300 );
  dlg->setMinimumHeight( 300 );
  dlg->show();
}
Esempio n. 23
0
void EditProfileDialog::showColorSchemeEditor(bool isNewScheme)
{    
    QModelIndexList selected = _ui->colorSchemeList->selectionModel()->selectedIndexes();

    QAbstractItemModel* model = _ui->colorSchemeList->model();
    const ColorScheme* colors = 0;
    if ( !selected.isEmpty() )
        colors = model->data(selected.first(),Qt::UserRole+1).value<const ColorScheme*>();
    else
        colors = ColorSchemeManager::instance()->defaultColorScheme();

    Q_ASSERT(colors);

    KDialog* dialog = new KDialog(this);

    if ( isNewScheme )
        dialog->setCaption(i18n("New Color Scheme"));
    else
        dialog->setCaption(i18n("Edit Color Scheme"));

    ColorSchemeEditor* editor = new ColorSchemeEditor;
    dialog->setMainWidget(editor);
    editor->setup(colors);

    if ( isNewScheme )
        editor->setDescription(i18n("New Color Scheme"));
        
    if ( dialog->exec() == QDialog::Accepted )
    {
        ColorScheme* newScheme = new ColorScheme(*editor->colorScheme());

        // if this is a new color scheme, pick a name based on the description
        if ( isNewScheme )
            newScheme->setName(newScheme->description());

        ColorSchemeManager::instance()->addColorScheme( newScheme );
        
        updateColorSchemeList(true);

        preview(Profile::ColorScheme,newScheme->name());
    }
}
Esempio n. 24
0
MRESULT EXPENTRY KDialog::DlgProc( HWND hwndDlg, ULONG msg, MPARAM mp1,
                                   MPARAM mp2 )
{
    if( msg == WM_INITDLG )
    {
        CreateParams* pcp = reinterpret_cast< CreateParams* >( mp2 );

        mp2 = pcp->pCreate;

        KDialog* pkdlg = pcp->pkdlg;

        // Subclass to KWindow::WndProc()
        pkdlg->SetHWND( hwndDlg );

        // Pass the control to KWindow::WndProc()
        return pkdlg->KWndProc( msg, mp1, mp2 );
    }

    return WinDefDlgProc( hwndDlg, msg, mp1, mp2 );
}
Esempio n. 25
0
void EditProfileDialog::showEnvironmentEditor()
{
    const Profile::Ptr info = lookupProfile();

    KDialog* dialog = new KDialog(this);
    QTextEdit* edit = new QTextEdit(dialog);

    QStringList currentEnvironment = info->property<QStringList>(Profile::Environment);

    edit->setPlainText( currentEnvironment.join("\n") );
    dialog->setPlainCaption(i18n("Edit Environment"));
    dialog->setMainWidget(edit);

    if ( dialog->exec() == QDialog::Accepted )
    {
        QStringList newEnvironment = edit->toPlainText().split('\n');
        _tempProfile->setProperty(Profile::Environment,newEnvironment);
    }

    dialog->deleteLater();
}
Esempio n. 26
0
void KDocumentTextBuffer::checkConsistency()
{
    QString bufferContents = codec()->toUnicode( slice(0, length())->text() );
    QString documentContents = kDocument()->text();
    if ( bufferContents != documentContents ) {
        KUrl url = kDocument()->url();
        kDocument()->setModified(false);
        kDocument()->setReadWrite(false);
        m_aboutToClose = true;
        QTemporaryFile f;
        f.setAutoRemove(false);
        f.open();
        f.close();
        kDocument()->saveAs(f.fileName());
        KDialog* dialog = new KDialog;
        dialog->setButtons(KDialog::Ok | KDialog::Cancel);
        QLabel* label = new QLabel(i18n("Sorry, an internal error occurred in the text synchronization component.<br>"
                                        "You can try to reload the document or disconnect."));
        label->setWordWrap(true);
        dialog->setMainWidget(label);
        dialog->button(KDialog::Ok)->setText(i18n("Reload document"));
        dialog->button(KDialog::Cancel)->setText(i18n("Disconnect"));
        DocumentReopenHelper* helper = new DocumentReopenHelper(url, kDocument());
        connect(dialog, SIGNAL(accepted()), helper, SLOT(reopen()));
        // We must not use exec() here, since that will create a nested event loop,
        // which might handle incoming network events. This can easily get very messy.
        dialog->show();
    }
}
Esempio n. 27
0
void Task::showPropertiesDialog()
{
    if (m_taskType != GroupType || !(m_applet->groupManager()->taskGrouper()->editableGroupProperties() & TaskManager::AbstractGroupingStrategy::Name))
    {
        return;
    }

    QWidget *groupWidget = new QWidget;

    m_groupUi.setupUi(groupWidget);
    m_groupUi.icon->setIcon(m_group->icon());
    m_groupUi.name->setText(m_group->name());

    KDialog *groupDialog = new KDialog;
    groupDialog->setMainWidget(groupWidget);
    groupDialog->setButtons(KDialog::Cancel | KDialog::Ok);

    connect(groupDialog, SIGNAL(okClicked()), this, SLOT(setProperties()));

    groupDialog->setWindowTitle(i18n("%1 Settings", m_group->name()));
    groupDialog->show();
}
Esempio n. 28
0
void LogFile::configureSettings(void)
{
	QPalette cgroup = monitor->palette();

	lfs = new Ui_LogFileSettings;
	Q_CHECK_PTR(lfs);
	KDialog dlg;
	dlg.setCaption( i18n("File logging settings") );
	dlg.setButtons( KDialog::Ok | KDialog::Cancel | KDialog::Apply );

	lfs->setupUi(dlg.mainWidget());

	lfs->fgColor->setColor(cgroup.color( QPalette::Text ));
	lfs->fgColor->setText(i18n("Foreground color:"));
	lfs->bgColor->setColor(cgroup.color( QPalette::Base ));
	lfs->bgColor->setText(i18n("Background color:"));
	lfs->fontRequester->setFont(monitor->font());
	lfs->ruleList->addItems(filterRules);
	lfs->title->setText(title());

	connect(&dlg, SIGNAL(okClicked()), &dlg, SLOT(accept()));
	connect(&dlg, SIGNAL(applyClicked()), this, SLOT(applySettings()));

	connect(lfs->addButton, SIGNAL(clicked()), this, SLOT(settingsAddRule()));
	connect(lfs->deleteButton, SIGNAL(clicked()), this, SLOT(settingsDeleteRule()));
	connect(lfs->changeButton, SIGNAL(clicked()), this, SLOT(settingsChangeRule()));
	connect(lfs->ruleList, SIGNAL(currentRowChanged(int)), this, SLOT(settingsRuleListSelected(int)));
	connect(lfs->ruleText, SIGNAL(returnPressed()), this, SLOT(settingsAddRule()));
	connect(lfs->ruleText, SIGNAL(textChanged(QString)), this, SLOT(settingsRuleTextChanged()));

	settingsRuleListSelected(lfs->ruleList->currentRow());
	settingsRuleTextChanged();

	if (dlg.exec())
		applySettings();

	delete lfs;
	lfs = 0;
}
void ExpressionLineEdit::insertComponent()
{
    if (!m_clock) {
        return;
    }

    ComponentWidget *componentWidget = new ComponentWidget(NULL, m_clock);
    KDialog *dialog = new KDialog(this);
    dialog->setMainWidget(componentWidget);
    dialog->setModal(false);
    dialog->setWindowTitle(i18n("Insert Clock Component"));
    dialog->setButtons(KDialog::Apply | KDialog::Close);
    dialog->button(KDialog::Apply)->setText(i18n("Insert"));
    dialog->button(KDialog::Apply)->setEnabled(false);
    dialog->show();

    connect(dialog->button(KDialog::Apply), SIGNAL(clicked()), componentWidget, SLOT(insertComponent()));
    connect(componentWidget, SIGNAL(componentChanged(bool)), dialog->button(KDialog::Apply), SLOT(setEnabled(bool)));
    connect(componentWidget, SIGNAL(insertComponent(QString,QString)), this, SLOT(insertComponent(QString,QString)));
}
Esempio n. 30
0
void Changecase::checkSection(QTextDocument *document, int startPosition, int endPosition)
{
    m_cursor = QTextCursor(document);
    m_cursor.setPosition(startPosition);
    m_cursor.setPosition(endPosition, QTextCursor::KeepAnchor);
    m_document = document;

    m_startPosition = startPosition;
    m_endPosition = endPosition;

    KDialog *dialog = new KDialog();
    dialog->setCaption(i18n("Change case"));
    dialog->setButtons(KDialog::Ok | KDialog::Cancel);

    QWidget *widget = new QWidget(dialog);

    m_sentenceCaseRadio = new QRadioButton(i18n("Sentence case"));
    m_lowerCaseRadio = new QRadioButton(i18n("lowercase"));
    m_upperCaseRadio = new QRadioButton(i18n("UPPER CASE"));
    m_initialCapsRadio = new QRadioButton(i18n("Initial Caps"));
    m_toggleCaseRadio = new QRadioButton(i18n("tOGGLE cASE"));

    QVBoxLayout *vLayout = new QVBoxLayout;
    vLayout->addWidget(m_sentenceCaseRadio);
    vLayout->addWidget(m_lowerCaseRadio);
    vLayout->addWidget(m_upperCaseRadio);
    vLayout->addWidget(m_initialCapsRadio);
    vLayout->addWidget(m_toggleCaseRadio);

    widget->setLayout(vLayout);
    dialog->setMainWidget(widget);

    dialog->show();

    connect(dialog, SIGNAL(accepted()), this, SLOT(process()));
}