Exemple #1
0
K3b::InteractionDialog::InteractionDialog( QWidget* parent,
        const QString& title,
        const QString& subTitle,
        int buttonMask,
        int defaultButton,
        const QString& configGroup )
    : QDialog( parent ),
      m_mainWidget(0),
      m_defaultButton(defaultButton),
      m_configGroup(configGroup),
      m_inToggleMode(false),
      m_delayedInit(false)
{
    installEventFilter( this );

    mainGrid = new QGridLayout( this );

    // header
    // ---------------------------------------------------------------------------------------------------
    m_dialogHeader = new K3b::ThemedHeader( this );
    mainGrid->addWidget( m_dialogHeader, 0, 0, 1, 3 );


    // settings buttons
    // ---------------------------------------------------------------------------------------------------
    if( !m_configGroup.isEmpty() ) {
        QHBoxLayout* layout2 = new QHBoxLayout;
        m_buttonLoadSettings = new QToolButton( this );
        m_buttonLoadSettings->setIcon( QIcon::fromTheme( "document-revert" ) );
        m_buttonLoadSettings->setPopupMode( QToolButton::InstantPopup );
        QMenu* userDefaultsPopup = new QMenu( m_buttonLoadSettings );
        userDefaultsPopup->addAction( i18n("Load default settings"), this, SLOT(slotLoadK3bDefaults()) );
        userDefaultsPopup->addAction( i18n("Load saved settings"), this, SLOT(slotLoadUserDefaults()) );
        userDefaultsPopup->addAction( i18n("Load last used settings"), this, SLOT(slotLoadLastSettings()) );
        m_buttonLoadSettings->setMenu( userDefaultsPopup );
        layout2->addWidget( m_buttonLoadSettings );

        m_buttonSaveSettings = new QToolButton( this );
        m_buttonSaveSettings->setIcon( QIcon::fromTheme( "document-save" ) );
        layout2->addWidget( m_buttonSaveSettings );

        mainGrid->addLayout( layout2, 2, 0 );
    }

    QSpacerItem* spacer = new QSpacerItem( 10, 10, QSizePolicy::Expanding, QSizePolicy::Minimum );
    mainGrid->addItem( spacer, 2, 1 );

    // action buttons
    // ---------------------------------------------------------------------------------------------------
    QDialogButtonBox *buttonBox = new QDialogButtonBox( this );
    connect( buttonBox, SIGNAL(accepted()), this, SLOT(accept()) );
    connect( buttonBox, SIGNAL(rejected()), this, SLOT(reject()) );

    if( buttonMask & START_BUTTON ) {
        m_buttonStart = new QPushButton( buttonBox );
        KGuiItem::assign( m_buttonStart, KStandardGuiItem::ok() );
        // refine the button text
        setButtonText( START_BUTTON,
                       i18n("Start"),
                       i18n("Start the task") );
        QFont fnt( m_buttonStart->font() );
        fnt.setBold(true);
        m_buttonStart->setFont( fnt );
        buttonBox->addButton( m_buttonStart, QDialogButtonBox::AcceptRole );
    }
    if( buttonMask & SAVE_BUTTON ) {
        m_buttonSave = new QPushButton( buttonBox );
        KGuiItem::assign( m_buttonSave, KStandardGuiItem::save() );
        buttonBox->addButton( m_buttonSave, QDialogButtonBox::ApplyRole );
    }
    else {
        m_buttonSave = 0;
    }
    if( buttonMask & CANCEL_BUTTON ) {
        m_buttonCancel = new QPushButton( buttonBox );
        KGuiItem::assign( m_buttonCancel, KConfigGroup( KSharedConfig::openConfig(), "General Options" )
                          .readEntry( "keep action dialogs open", false )
                          ? KStandardGuiItem::close()
                          : KStandardGuiItem::cancel() );
        buttonBox->addButton( m_buttonCancel, QDialogButtonBox::RejectRole );
    }
    else {
        m_buttonCancel = 0;
    }

    mainGrid->addWidget( buttonBox, 2, 2 );
    mainGrid->setRowStretch( 1, 1 );

    setTitle( title, subTitle );

    initConnections();
    initToolTipsAndWhatsThis();

    setDefaultButton( START_BUTTON );
}
SpecialOrderEditor::SpecialOrderEditor( QWidget *parent, bool newOne )
: KDialog( parent )
{
    m_modelAssigned = false;
    priceEach   = 0;
    paymentEach = 0;
    
    groupInfo.isAvailable = true;
    groupInfo.cost  = 0;
    groupInfo.price = 0;
    groupInfo.count = 0;
    groupInfo.name  = "";

    ui = new SpecialOrderUI( this );
    setMainWidget( ui );
    setCaption( i18n("Special Orders") );
    setButtons( KDialog::Ok|KDialog::Cancel );

    //Set Validators for input boxes
    ui->editAddQty->setValidator(new QDoubleValidator(0.00, 999999999999.99, 3, ui->editAddQty));

    ui->editQty->setValue(1);
    ui->editAddQty->setText("1.00");

    connect( ui->editQty, SIGNAL(editingFinished()), this, SLOT(calculateCost()));
    connect( ui->editQty, SIGNAL(valueChanged(int)), this, SLOT(calculateCost()));

    connect( ui->editQty, SIGNAL(editingFinished()), this, SLOT(checkFieldsState()));
    connect( ui->editPayment, SIGNAL(valueChanged(double)), this, SLOT(checkFieldsState()));
    

    connect( ui->editFilter, SIGNAL(textEdited ( const QString &)), SLOT(applyFilter(const QString &)) );
    connect( ui->btnAdd,    SIGNAL(clicked()), SLOT(addItem()) );
    connect( ui->editAddQty,    SIGNAL(returnPressed()), SLOT(addItem()) );
    connect( ui->btnRemove, SIGNAL(clicked()), SLOT(removeItem()) );
    connect( ui->groupView, SIGNAL(itemDoubleClicked(QTableWidgetItem*)), SLOT(itemDoubleClicked(QTableWidgetItem*)) );

    connect( ui->deliveryDT, SIGNAL(valueChanged(QDateTime)), this, SLOT(checkDate(QDateTime)) );

    connect( ui->editNotes, SIGNAL(textChanged()), SLOT(updateNoteLength()) );

    //for now, when creating a s.o. the status cannot be modified. It can be when edited.
    if (newOne) {
      dateTime         = QDateTime::currentDateTime();
      ui->deliveryDT->setDateTime(QDateTime::currentDateTime().addDays(1));
    }

    //tip
    QString path = KStandardDirs::locate("appdata", "styles/");
    path = path+"tip.svg";
    qtyTip   = new MibitTip(this, ui->editQty, path, DesktopIcon("dialog-warning",32) );
    path = KStandardDirs::locate("appdata", "styles/")+"rotated_tip.svg";
    groupTip = new MibitTip(this, ui->groupView, path, DesktopIcon("dialog-warning",32), tpAbove );

    path = KStandardDirs::locate("appdata", "styles/");
    path = path+"floating_bottom.svg";
    newClientPanel = new MibitFloatPanel(this, path, Top);
    newClientPanel->setSize(550,250);
    newClientPanel->addWidget(ui->frameClient);
    newClientPanel->setMode(pmManual);
    newClientPanel->setHiddenTotally(true);
    ui->editClientName->setEmptyMessage(i18n("Enter client name here..."));
    ui->editClientPhone->setEmptyMessage(i18n("Enter client phone here..."));
    ui->editClientCell->setEmptyMessage(i18n("Enter client cell phone here..."));

    connect( ui->btnNewClient, SIGNAL(clicked()), newClientPanel, SLOT(showPanel() ));
    connect( ui->btnNewClient, SIGNAL(clicked()), this, SLOT(enableCreateClient() ));
    connect( ui->btnClientCancel, SIGNAL(clicked()), newClientPanel, SLOT(hidePanel()));
    connect( ui->btnClientAdd, SIGNAL(clicked()), this, SLOT(createClient()));
    connect( ui->editClientName, SIGNAL(textEdited(const QString &)), this, SLOT(checkValidInfo()) );
    connect( ui->editClientAddress, SIGNAL(textChanged()), this, SLOT(checkValidInfo()) );
    connect( ui->editClientPhone, SIGNAL(textEdited(const QString &)), this, SLOT(checkValidInfo()) );
    connect( ui->editClientCell, SIGNAL(textEdited(const QString &)), this, SLOT(checkValidInfo()) );

    setDefaultButton(KDialog::None);
    ui->btnFilter->setDefault(true);
    ui->btnFilter->hide(); //hack to dont have a default OK or Cancel button

    ui->clientsCombo->setFocus();
    enableButtonOk(false);
}
Exemple #3
0
StatisticsDialog::StatisticsDialog(KileProject *project, KileDocument::TextInfo* docinfo, QWidget* parent,
                                   KTextEditor::View *view, const char* name, const QString &caption)
		: KPageDialog(parent), m_project(project), m_docinfo(docinfo), m_view(view)
{
	setObjectName(name);
	setFaceType(Tabbed);
	setCaption(caption);
	setModal(true);
	setButtons(Help | Close | User1 | User2);
	setDefaultButton(Close);
	showButtonSeparator(false);

	setButtonText(User1, i18n("Copy"));
	setButtonText(User2, i18n("Copy as LaTeX"));
	setHelp("statistics");

	m_summarystats = new long[SIZE_STAT_ARRAY];
	m_summarystats[0] = m_summarystats[1] = m_summarystats[2] = m_summarystats[3] = m_summarystats[4] = m_summarystats[5] = 0;

	const long* stats;
	QString tempName;
	KileWidget::StatisticsWidget* tempWidget;
	KileWidget::StatisticsWidget* summary;
	KileDocument::TextInfo* tempDocinfo;

	m_hasSelection = false; // class variable, if the user has selected text,
	summary = new KileWidget::StatisticsWidget(mainWidget());
	KPageWidgetItem *itemSummary = new KPageWidgetItem(summary, i18n("Summary"));
	addPage(itemSummary);
	summary->m_commentAboutHelp->setText(i18n("For information about the accuracy see the Help."));
	// we have in every case a summary tab

	m_pagetowidget[itemSummary] = summary;
	m_pagetoname[itemSummary] = i18n("Summary");

	if (m_docinfo->getDoc()->activeView()->selection()) { // the user should really have that doc as active in which the selection is
		m_hasSelection = true;
	}

	if (!m_project) { // the active doc doesn't belong to a project
		setCaption(i18n("Statistics for %1", m_docinfo->getDoc()->url().fileName()));
		stats = m_docinfo->getStatistics(m_view);
		fillWidget(stats, summary);
	}
	else { // active doc belongs to a project
		setCaption(i18n("Statistics for the Project %1", m_project->name()));
		KILE_DEBUG() << "Project file is " << project->baseURL() << endl;

		QList<KileProjectItem*> items = project->items();

		if (m_hasSelection) { // if the active doc has a selection
			stats = m_docinfo->getStatistics(m_view);
			fillWidget(stats, summary); // if yes we fill the summary widget and are finished
		}
		else {
			for(QList<KileProjectItem*>::iterator i = items.begin(); i != items.end(); ++i) {
				KileProjectItem *item = *i;

				if (item->type() ==  KileProjectItem::ProjectFile) { // ignore project files
					continue;
				}

				tempDocinfo = item->getInfo();
				if(tempDocinfo && tempDocinfo->getDoc()) { // closed items don't have a doc
					tempName = tempDocinfo->getDoc()->url().fileName();
					stats = tempDocinfo->getStatistics(m_view);

					for (uint j = 0; j < SIZE_STAT_ARRAY; j++) {
						m_summarystats[j] += stats[j];
					}

					tempWidget = new KileWidget::StatisticsWidget();
					KPageWidgetItem *itemTemp = new KPageWidgetItem(tempWidget, tempName);
					addPage(itemTemp);
					KILE_DEBUG() << "TempName is " << tempName << endl;
					m_pagetowidget[itemTemp] = tempWidget;
					m_pagetoname[itemTemp] = tempName;
					fillWidget(stats, tempWidget);
				}
				else {
					m_notAllFilesOpenWarning = true; // print warning
				}
			}

			fillWidget(m_summarystats, summary);
			if (m_notAllFilesOpenWarning) {
				summary->m_warning->setText(i18n("To get statistics for all project files, you have to open them all."));
			}

			KILE_DEBUG() << "All keys in name " << m_pagetoname.keys() << " Nr. of keys " << m_pagetowidget.count() << endl;
			KILE_DEBUG() << "All keys in widget " << m_pagetowidget.keys() << " Nr. of keys " << m_pagetowidget.count() << endl;
		}
	}
//  setInitialSize( QSize(550,560), true);
}
Exemple #4
0
KateMwModOnHdDialog::KateMwModOnHdDialog( DocVector docs, QWidget *parent, const char *name )
    : KDialog( parent ),
      m_proc( 0 ),
      m_diffFile( 0 )
{
  setCaption( i18n("Documents Modified on Disk") );
  setButtons( User1 | User2 | User3 );
  setButtonGuiItem( User1, KGuiItem (i18n("&Ignore"), "window-close") );
  setButtonGuiItem( User2, KStandardGuiItem::overwrite() );
  setButtonGuiItem( User3, KGuiItem (i18n("&Reload"), "view-refresh") );

  setObjectName( name );
  setModal( true );
  setDefaultButton( KDialog::User3 );

  setButtonWhatsThis( User1, i18n(
                        "Removes the modified flag from the selected documents and closes the "
                        "dialog if there are no more unhandled documents.") );
  setButtonWhatsThis( User2, i18n(
                        "Overwrite selected documents, discarding the disk changes and closes the "
                        "dialog if there are no more unhandled documents.") );
  setButtonWhatsThis( User3, i18n(
                        "Reloads the selected documents from disk and closes the dialog if there "
                        "are no more unhandled documents.") );

  KVBox *w = new KVBox( this );
  setMainWidget( w );
  w->setSpacing( KDialog::spacingHint() );

  KHBox *lo1 = new KHBox( w );

  // dialog text
  QLabel *icon = new QLabel( lo1 );
  icon->setPixmap( DesktopIcon("dialog-warning") );

  QLabel *t = new QLabel( i18n(
                            "<qt>The documents listed below have changed on disk.<p>Select one "
                            "or more at once, and press an action button until the list is empty.</p></qt>"), lo1 );
  lo1->setStretchFactor( t, 1000 );

  // document list
  twDocuments = new QTreeWidget( w );
  QStringList header;
  header << i18n("Filename") << i18n("Status on Disk");
  twDocuments->setHeaderLabels(header);
  twDocuments->setSelectionMode( QAbstractItemView::SingleSelection );
  twDocuments->setRootIsDecorated( false );

  
  m_stateTexts << "" << i18n("Modified") << i18n("Created") << i18n("Deleted");
  for ( int i = 0; i < docs.size(); i++ )
  {
    new KateDocItem( docs[i], m_stateTexts[ (uint)KateDocManager::self()->documentInfo( docs[i] )->modifiedOnDiscReason ], twDocuments );
  }
  twDocuments->header()->setStretchLastSection(false);
  twDocuments->header()->setResizeMode(0, QHeaderView::Stretch);
  twDocuments->header()->setResizeMode(1, QHeaderView::ResizeToContents);

  connect( twDocuments, SIGNAL(currentItemChanged(QTreeWidgetItem*,QTreeWidgetItem*)), this, SLOT(slotSelectionChanged(QTreeWidgetItem*,QTreeWidgetItem*)) );

  // diff button
  KHBox *lo2 = new KHBox ( w );
  QWidget *d = new QWidget (lo2);
  lo2->setStretchFactor (d, 2);
  btnDiff = new KPushButton( KGuiItem (i18n("&View Difference"), "document-preview"), lo2 );

  btnDiff->setWhatsThis(i18n(
                          "Calculates the difference between the editor contents and the disk "
                          "file for the selected document, and shows the difference with the "
                          "default application. Requires diff(1).") );
  connect( btnDiff, SIGNAL(clicked()), this, SLOT(slotDiff()) );
  connect( this, SIGNAL(user1Clicked()), this, SLOT(slotUser1()) );
  connect( this, SIGNAL(user2Clicked()), this, SLOT(slotUser2()) );
  connect( this, SIGNAL(user3Clicked()), this, SLOT(slotUser3()) );

  slotSelectionChanged(NULL, NULL);
}
IngredientParserDialog::IngredientParserDialog( const UnitList &units, QWidget* parent, const char* name )
		: KDialog( parent ),
		m_unitList(units)
{
	//setButtonBoxOrientation( Qt::Vertical );
	setObjectName( name );
	setCaption(i18nc( "@title:window", "Ingredient Parser" ));
	setButtons(KDialog::Ok | KDialog::Cancel);
	setDefaultButton(KDialog::Ok);
	setModal( true );

	KVBox *page = new KVBox( this );
	setMainWidget( page );

	textLabel1 = new QLabel( page );
	textLabel1->setObjectName( "textLabel1" );
	textLabel1->setTextFormat( Qt::RichText );

	ingredientTextEdit = new KTextEdit( page );
	ingredientTextEdit->setObjectName( "ingredientTextEdit" );
	ingredientTextEdit->setAcceptRichText( false );

	parseButton = new KPushButton( page );

	previewLabel = new QLabel( page );
	previewLabel->setObjectName( "previewLabel" );
	previewLabel->setTextFormat( Qt::RichText );

	previewIngView = new K3ListView( page );
	previewIngView->setSorting(-1);
	previewIngView->addColumn( i18nc( "@title:column", "Ingredient" ) );
	previewIngView->addColumn( i18nc( "@title:column", "Amount" ) );
	previewIngView->addColumn( i18nc( "@title:column", "Unit" ) );
	previewIngView->addColumn( i18nc( "@title:column", "Preparation Method" ) );

	languageChange();
	setInitialSize( QSize(577, 371).expandedTo(minimumSizeHint()) );

	previewIngView->setItemsRenameable( true );
	previewIngView->setRenameable( 0, true );
	previewIngView->setRenameable( 1, true );
	previewIngView->setRenameable( 2, true );
	previewIngView->setRenameable( 3, true );

	previewIngView->setSelectionMode( Q3ListView::Extended );

	ingredientTextEdit->setText( QApplication::clipboard()->text() );
	ingredientTextEdit->selectAll();

	QWidget *buttonWidget = new QWidget( page );
	QHBoxLayout *buttonBox = new QHBoxLayout(buttonWidget);
	QSpacerItem *horizontalSpacing = new QSpacerItem( 20, 20, QSizePolicy::Expanding, QSizePolicy::Minimum );
	buttonGroup = new QPushButton( i18nc("@action:button", "Set &Header"), buttonWidget );
	buttonGroup->setWhatsThis( i18nc( "@info:whatsthis", "If an ingredient header is detected as an ingredient, select it and click this button so that Krecipes will recognize it as a header.  All the ingredients below the header will be included within that group.\n\nAlternatively, if you select multiple ingredients and click this button, those ingredients will be grouped together.") );
	buttonBox->addWidget( buttonGroup );
	buttonBox->addItem( horizontalSpacing );

	KMenu *kpop = new KMenu( previewIngView );
	kpop->addAction( i18nc( "@item:inmenu", "&Delete" ), this, SLOT( removeIngredient() ), Qt::Key_Delete );
	kpop->addAction( i18nc( "@item:inmenu", "Set &Header") , this, SLOT( convertToHeader() ) );

	connect( parseButton, SIGNAL(clicked()), this, SLOT(parseText()) );
	connect( buttonGroup, SIGNAL(clicked()), this, SLOT(convertToHeader()) );
}
AnnotsPropertiesDialog::AnnotsPropertiesDialog( QWidget *parent, Okular::Document *document, int docpage, Okular::Annotation *ann )
    : KPageDialog( parent ), m_document( document ), m_page( docpage ), modified( false )
{
    setFaceType( Tabbed );
    m_annot=ann;
    const bool canEditAnnotations = m_document->canModifyPageAnnotation( ann );
    setCaptionTextbyAnnotType();
    if ( canEditAnnotations )
    {
        setButtons( Ok | Apply | Cancel );
        enableButton( Apply, false );
        connect( this, SIGNAL(applyClicked()), this, SLOT(slotapply()) );
        connect( this, SIGNAL(okClicked()), this, SLOT(slotapply()) );
    }
    else
    {
        setButtons( Close );
        setDefaultButton( Close );
    }

    m_annotWidget = AnnotationWidgetFactory::widgetFor( ann );

    QLabel* tmplabel;
  //1. Appearance
    //BEGIN tab1
    QFrame *page = new QFrame( this );
    addPage( page, i18n( "&Appearance" ) );
    QGridLayout * gridlayout = new QGridLayout( page );

    tmplabel = new QLabel( i18n( "&Color:" ), page );
    gridlayout->addWidget( tmplabel, 0, 0, Qt::AlignRight );
    colorBn = new KColorButton( page );
    colorBn->setColor( ann->style().color() );
    colorBn->setEnabled( canEditAnnotations );
    tmplabel->setBuddy( colorBn );
    gridlayout->addWidget( colorBn, 0, 1 );

    tmplabel = new QLabel( i18n( "&Opacity:" ), page );
    gridlayout->addWidget( tmplabel, 1, 0, Qt::AlignRight );
    m_opacity = new KIntNumInput( page );
    m_opacity->setRange( 0, 100 );
    m_opacity->setValue( (int)( ann->style().opacity() * 100 ) );
    m_opacity->setSuffix( i18nc( "Suffix for the opacity level, eg '80 %'", " %" ) );
    m_opacity->setEnabled( canEditAnnotations );
    tmplabel->setBuddy( m_opacity );
    gridlayout->addWidget( m_opacity, 1, 1 );

    QWidget * configWidget = 0;
    if ( m_annotWidget && ( configWidget = m_annotWidget->styleWidget() ) )
    {
        gridlayout->addWidget( configWidget, 2, 0, 1, 2 );
        configWidget->setEnabled( canEditAnnotations );
    }

    gridlayout->addItem( new QSpacerItem( 5, 5, QSizePolicy::Fixed, QSizePolicy::MinimumExpanding ), 3, 0 );
    //END tab1

    //BEGIN tab 2
    page = new QFrame( this );
    addPage( page, i18n( "&General" ) );
//    m_tabitem[1]->setIcon( KIcon( "fonts" ) );
    gridlayout = new QGridLayout( page );
    tmplabel = new QLabel( i18n( "&Author:" ), page );
    AuthorEdit = new KLineEdit( ann->author(), page );
    AuthorEdit->setEnabled( canEditAnnotations );
    tmplabel->setBuddy( AuthorEdit );
    gridlayout->addWidget( tmplabel, 0, 0, Qt::AlignRight );
    gridlayout->addWidget( AuthorEdit, 0, 1 );

    tmplabel = new QLabel( page );
    tmplabel->setText( i18n( "Created: %1", KGlobal::locale()->formatDateTime( ann->creationDate(), KLocale::LongDate, true ) ) );
    tmplabel->setTextInteractionFlags( Qt::TextSelectableByMouse );
    gridlayout->addWidget( tmplabel, 1, 0, 1, 2 );

    m_modifyDateLabel = new QLabel( page );
    m_modifyDateLabel->setText( i18n( "Modified: %1", KGlobal::locale()->formatDateTime( ann->modificationDate(), KLocale::LongDate, true ) ) );
    m_modifyDateLabel->setTextInteractionFlags( Qt::TextSelectableByMouse );
    gridlayout->addWidget( m_modifyDateLabel, 2, 0, 1, 2 );

    gridlayout->addItem( new QSpacerItem( 5, 5, QSizePolicy::Fixed, QSizePolicy::MinimumExpanding ), 3, 0 );
    //END tab 2

    QWidget * extraWidget = 0;
    if ( m_annotWidget && ( extraWidget = m_annotWidget->extraWidget() ) )
    {
        addPage( extraWidget, extraWidget->windowTitle() );
    }

    //BEGIN connections
    connect( colorBn, SIGNAL(changed(QColor)), this, SLOT(setModified()) );
    connect( m_opacity, SIGNAL(valueChanged(int)), this, SLOT(setModified()) );
    connect( AuthorEdit, SIGNAL(textChanged(QString)), this, SLOT(setModified()) );
    if ( m_annotWidget )
    {
        connect( m_annotWidget, SIGNAL(dataChanged()), this, SLOT(setModified()) );
    }
    //END

#if 0
    kDebug() << "Annotation details:";
    kDebug().nospace() << " => unique name: '" << ann->uniqueName() << "'";
    kDebug() << " => flags:" << QString::number( m_annot->flags(), 2 );
#endif

    resize( sizeHint() );
}
Exemple #7
0
KDirSelectDialog::KDirSelectDialog(const KUrl &startDir, bool localOnly,
                                   QWidget *parent)
#ifdef Q_WS_WIN
    : KDialog( parent , Qt::WindowMinMaxButtonsHint),
#else
    : KDialog( parent ),
#endif
      d( new Private( localOnly, this ) )
{
    setCaption( i18nc("@title:window","Select Folder") );
    setButtons( Ok | Cancel | User1 );
    setButtonGuiItem( User1, KGuiItem( i18nc("@action:button","New Folder..."), "folder-new" ) );
    setDefaultButton(Ok);
    button(Ok)->setFocus();

    QFrame *page = new QFrame(this);
    setMainWidget(page);
    QHBoxLayout *hlay = new QHBoxLayout( page);
    hlay->setMargin(0);
    QVBoxLayout *mainLayout = new QVBoxLayout();
    d->m_actions=new KActionCollection(this);
    d->m_actions->addAssociatedWidget(this);
    d->m_placesView = new KFilePlacesView( page );
    d->m_placesView->setModel(new KFilePlacesModel(d->m_placesView));
    d->m_placesView->setObjectName( QLatin1String( "speedbar" ) );
    d->m_placesView->setHorizontalScrollBarPolicy( Qt::ScrollBarAlwaysOff );
    d->m_placesView->setSizePolicy(QSizePolicy::Minimum, QSizePolicy::Minimum);
    connect( d->m_placesView, SIGNAL( urlChanged( const KUrl& )),
             SLOT( setCurrentUrl( const KUrl& )) );
    hlay->addWidget( d->m_placesView );
    hlay->addLayout( mainLayout );

    d->m_treeView = new KFileTreeView(page);
    d->m_treeView->setDirOnlyMode(true);
    d->m_treeView->setContextMenuPolicy(Qt::CustomContextMenu);

    for (int i = 1; i < d->m_treeView->model()->columnCount(); ++i)
        d->m_treeView->hideColumn(i);

    d->m_urlCombo = new KHistoryComboBox( page);
    d->m_urlCombo->setLayoutDirection( Qt::LeftToRight );
    d->m_urlCombo->setSizeAdjustPolicy(QComboBox::AdjustToMinimumContentsLength);
    d->m_urlCombo->setTrapReturnKey( true );
    d->m_urlCombo->setPixmapProvider( new KUrlPixmapProvider() );
    KUrlCompletion *comp = new KUrlCompletion();
    comp->setMode( KUrlCompletion::DirCompletion );
    d->m_urlCombo->setCompletionObject( comp, true );
    d->m_urlCombo->setAutoDeleteCompletionObject( true );
    d->m_urlCombo->setDuplicatesEnabled( false );

    d->m_contextMenu = new KMenu( this );

    KAction* newFolder = new KAction( i18nc("@action:inmenu","New Folder..."), this);
    d->m_actions->addAction( newFolder->objectName(), newFolder );
    newFolder->setIcon( KIcon( "folder-new" ) );
    newFolder->setShortcut( Qt::Key_F10);
    connect( newFolder, SIGNAL( triggered( bool ) ), this, SLOT( slotNewFolder() ) );
    d->m_contextMenu->addAction( newFolder );

    d->moveToTrash = new KAction( i18nc( "@action:inmenu","Move to Trash" ), this );
    d->m_actions->addAction( d->moveToTrash->objectName(), d->moveToTrash );
    d->moveToTrash->setIcon( KIcon( "user-trash" ) );
    d->moveToTrash->setShortcut(KShortcut(Qt::Key_Delete));
    connect( d->moveToTrash, SIGNAL( triggered( bool ) ), this, SLOT( slotMoveToTrash() ) );
    d->m_contextMenu->addAction( d->moveToTrash );

    d->deleteAction = new KAction( i18nc("@action:inmenu","Delete"), this );
    d->m_actions->addAction( d->deleteAction->objectName(), d->deleteAction );
    d->deleteAction->setIcon( KIcon( "edit-delete" ) );
    d->deleteAction->setShortcut( KShortcut( Qt::SHIFT + Qt::Key_Delete ) );
    connect( d->deleteAction, SIGNAL( triggered( bool ) ), this, SLOT( slotDelete() ) );
    d->m_contextMenu->addAction( d->deleteAction );

    d->m_contextMenu->addSeparator();

    d->showHiddenFoldersAction = new KToggleAction( i18nc("@option:check", "Show Hidden Folders"), this );
    d->m_actions->addAction( d->showHiddenFoldersAction->objectName(), d->showHiddenFoldersAction );
    d->showHiddenFoldersAction->setShortcut( Qt::Key_F8 );
    connect( d->showHiddenFoldersAction, SIGNAL( triggered( bool ) ), d->m_treeView, SLOT( setShowHiddenFiles( bool ) ) );
    d->m_contextMenu->addAction( d->showHiddenFoldersAction );
    d->m_contextMenu->addSeparator();

    KAction* propertiesAction = new KAction( i18nc("@action:inmenu","Properties"), this);
    d->m_actions->addAction(propertiesAction->objectName(), propertiesAction);
    propertiesAction->setIcon(KIcon("document-properties"));
    propertiesAction->setShortcut(KShortcut(Qt::ALT + Qt::Key_Return));
    connect( propertiesAction, SIGNAL( triggered( bool ) ), this, SLOT( slotProperties() ) );
    d->m_contextMenu->addAction( propertiesAction );

    d->m_startURL = KFileDialog::getStartUrl( startDir, d->m_recentDirClass );
    if ( localOnly && !d->m_startURL.isLocalFile() )
    {
        d->m_startURL = KUrl();
        QString docPath = KGlobalSettings::documentPath();
        if (QDir(docPath).exists())
            d->m_startURL.setPath( docPath );
        else
            d->m_startURL.setPath( QDir::homePath() );
    }

    d->m_startDir = d->m_startURL;
    d->m_rootUrl = d->m_treeView->rootUrl();

    d->readConfig( KGlobal::config(), "DirSelect Dialog" );

    mainLayout->addWidget( d->m_treeView, 1 );
    mainLayout->addWidget( d->m_urlCombo, 0 );

    connect( d->m_treeView, SIGNAL( currentChanged(const KUrl&)),
             SLOT( slotCurrentChanged() ));
    connect( d->m_treeView, SIGNAL( activated(const QModelIndex&)),
             SLOT( slotExpand(const QModelIndex&) ));
    connect( d->m_treeView, SIGNAL( customContextMenuRequested( const QPoint & )),
             SLOT( slotContextMenuRequested( const QPoint & )));

    connect( d->m_urlCombo, SIGNAL( editTextChanged( const QString& ) ),
             SLOT( slotComboTextChanged( const QString& ) ));
    connect( d->m_urlCombo, SIGNAL( activated( const QString& )),
             SLOT( slotUrlActivated( const QString& )));
    connect( d->m_urlCombo, SIGNAL( returnPressed( const QString& )),
             SLOT( slotUrlActivated( const QString& )));

    connect(this, SIGNAL(user1Clicked()), this, SLOT(slotNewFolder()));

    setCurrentUrl(d->m_startURL);
}
Exemple #8
0
void KGrSLDialog::setupWidgets()
{
    int margin		= marginHint(); 
    int spacing		= spacingHint(); 
    QWidget * dad	= new QWidget (this);
    setMainWidget (dad);
    setCaption (i18n ("Select Game"));
    setButtons (KDialog::Ok | KDialog::Cancel | KDialog::Help);
    setDefaultButton (KDialog::Ok);

    QVBoxLayout * mainLayout = new QVBoxLayout (dad);
    mainLayout->setSpacing (spacing);
    mainLayout->setMargin (margin);

    gameL    = new QLabel
                (i18n ("<html><b>Please select a game:</b></html>"), dad);
    mainLayout->addWidget (gameL, 5);

    games    = new QTreeWidget (dad);
    mainLayout->addWidget (games, 50);
    games->setColumnCount (4);
    games->setHeaderLabels (QStringList() <<
                            i18n ("Name of Game") <<
                            i18n ("Rules") <<
                            i18n ("Levels") <<
                            i18n ("Skill"));
    games->setRootIsDecorated (false);

    QHBoxLayout * hboxLayout1 = new QHBoxLayout();
    hboxLayout1->setSpacing (6);
    hboxLayout1->setMargin (0);

    gameN    = new QLabel ("", dad);	// Name of selected game.
    QFont f = gameN->font();
    f.setBold (true);
    gameN->setFont (f);
    hboxLayout1->addWidget (gameN);

    QSpacerItem * spacerItem1 = new QSpacerItem
                        (21, 20, QSizePolicy::Expanding, QSizePolicy::Minimum);
    hboxLayout1->addItem (spacerItem1);

    gameD    = new QLabel ("", dad);		// Description of game.
    hboxLayout1->addWidget (gameD);
    mainLayout->addLayout (hboxLayout1, 5);

    gameAbout = new QTextEdit (dad);
    gameAbout->setReadOnly (true);
    mainLayout->addWidget (gameAbout, 25);

    QFrame * separator = new QFrame (dad);
    separator->setFrameShape (QFrame::HLine);
    mainLayout->addWidget (separator);

    if ((slAction == SL_START) || (slAction == SL_UPD_GAME)) {
        dad->	setWindowTitle (i18n ("Select Game"));
        QLabel * startMsg = new QLabel
            ("<b>" + i18n ("Level 1 of the selected game is:") + "</b>", dad);
        mainLayout->addWidget (startMsg, 5);
    }
    else {
        dad->	setWindowTitle (i18n ("Select Game/Level"));
        QLabel * selectLev = new QLabel
            ("<b>" + i18n ("Please select a level:") + "</b>", dad);
        mainLayout->addWidget (selectLev, 5);
    }

    QGridLayout * grid = new QGridLayout;
    mainLayout->addLayout (grid);

    number    = new QScrollBar (Qt::Vertical, dad);
    number->setRange (1, 150);
    number->setSingleStep (1);
    number->setPageStep (10);
    number->setValue (1);
    grid->addWidget (number, 1, 5, 4, 1);

    QWidget * numberPair = new QWidget (dad);
    QHBoxLayout *hboxLayout2 = new QHBoxLayout (numberPair);
    hboxLayout2->setMargin (0);
    numberPair->setLayout (hboxLayout2);
    grid->addWidget (numberPair, 1, 1, 1, 3);
    numberL   = new QLabel (i18n ("Level number:"), numberPair);
    display   = new KIntSpinBox (numberPair);
    display->setRange (1, 150);
    hboxLayout2->addWidget (numberL);
    hboxLayout2->addWidget (display);

    levelNH   = new QPushButton (i18n ("Edit Level Name && Hint"), dad);
    mainLayout->addWidget (levelNH);

    slName    = new QLabel ("", dad);
    grid->addWidget (slName, 2, 1, 1, 4);
    thumbNail = new KGrThumbNail (dad);
    grid->addWidget (thumbNail, 1, 6, 4, 5);

    // Set thumbnail cell size to about 1/5 of game cell size.
    int cellSize = slParent->width() / (5 * (FIELDWIDTH + 4));
    cellSize =  (cellSize < 4) ? 4 : cellSize;
    thumbNail->	setFixedWidth  ((FIELDWIDTH  * cellSize) + 2);
    thumbNail->	setFixedHeight ((FIELDHEIGHT * cellSize) + 2);

    // Base the geometry of the dialog box on the playing area.
    int cell =  slParent->width() / (FIELDWIDTH + 4);
    dad->	setMinimumSize ((FIELDWIDTH*cell/2), (FIELDHEIGHT-3)*cell);

    // Avoid spilling into the Taskbar or Apple Dock area if they get too close.
    // Otherwise allow the dialog to choose its size and then be resizeable.
    const QRect avail = QApplication::desktop()->availableGeometry(this);
    if ((avail.height() - slParent->height()) <= 120) {
        dad->setFixedHeight (slParent->height() - 120);	// Keep 120 for buttons.
    }

    // Set the default for the level-number in the scrollbar.
    number->	setTracking (true);
    number->setValue (defaultLevel);

    slSetGames (defaultGame);

    // Vary the dialog according to the action.
    QString OKText = "";
    switch (slAction) {
    case SL_START:	// Must start at level 1, but can choose a game.
                        OKText = i18n ("Start Game");
                        number->setValue (1);
                        number->setEnabled (false);
                        display->setEnabled (false);
                        number->hide();
                        numberL->hide();
                        display->hide();
                        break;
    case SL_ANY:	// Can start playing at any level in any game.
                        OKText = i18n ("Play Level");
                        break;
    case SL_REPLAY:	// Can ask to see a replay of any level in any game.
                        OKText = i18n ("Replay Level");
                        break;
    case SL_SOLVE:	// Can ask to see a solution of any level in any game.
                        OKText = i18n ("Show Solution");
                        break;
    case SL_SAVE_SOLUTION: // Can ask to save a recording on a solution-file.
                        OKText = i18n ("Save A Solution");
                        break;
    case SL_UPDATE:	// Can use any level in any game as edit input.
                        OKText = i18n ("Edit Level");
                        break;
    case SL_CREATE:	// Can save a new level only in a USER game.
                        OKText = i18n ("Save New");
                        break;
    case SL_SAVE:	// Can save an edited level only in a USER game.
                        OKText = i18n ("Save Change");
                        break;
    case SL_DELETE:	// Can delete a level only in a USER game.
                        OKText = i18n ("Delete Level");
                        break;
    case SL_MOVE:	// Can move a level only into a USER game.
                        OKText = i18n ("Move To...");
                        break;
    case SL_UPD_GAME:	// Can only edit USER game details.
                        OKText = i18n ("Edit Game Info");
                        number->setValue (1);
                        number->setEnabled (false);
                        display->setEnabled (false);
                        number->hide();
                        numberL->hide();
                        display->hide();
                        break;

    default:		break;			// Keep the default settings.
    }
    if (!OKText.isEmpty()) {
        setButtonGuiItem (KDialog::Ok, KGuiItem (OKText));
    }

    // Set value in the line-edit box.
    slShowLevel (number->value());

    if (display->isEnabled()) {
        display->setFocus();			// Set the keyboard input on.
        display->selectAll();
    }

    // Paint a thumbnail sketch of the level.
    thumbNail->setFrameStyle (QFrame::Box | QFrame::Plain);
    thumbNail->setLineWidth (1);
    slPaintLevel();
    thumbNail->show();

    connect (games,   SIGNAL (itemSelectionChanged()), this, SLOT (slGame()));

    connect (display, SIGNAL (valueChanged(QString)),
                this, SLOT (slUpdate(QString)));

    connect (number, SIGNAL(valueChanged(int)), this, SLOT(slShowLevel(int)));

    // Only enable name and hint dialog here if saving a new or edited level.
    // At other times the name and hint have not been loaded or initialised yet.
    if ((slAction == SL_CREATE) || (slAction == SL_SAVE)) {
        // Signal editNameAndHint() relays the click to a KGrEditor connection.
        connect (levelNH, SIGNAL (clicked()),
                 this,    SIGNAL (editNameAndHint()));
    }
    else {
        levelNH->setEnabled (false);
        levelNH->hide();
    }

    connect (games, SIGNAL(itemSelectionChanged()), this, SLOT(slPaintLevel()));
    connect (number,  SIGNAL (sliderReleased()), this, SLOT (slPaintLevel()));

    connect (this,    SIGNAL (helpClicked()), this, SLOT (slotHelp()));
}
KexiCSVImportOptionsDialog::KexiCSVImportOptionsDialog(
    const KexiCSVImportOptions& options, QWidget* parent)
        : KDialog(parent)
{
    setWindowTitle(i18n("CSV Import Options"));
    setButtons(Ok | Cancel);
    setDefaultButton(Ok);
    setObjectName("KexiCSVImportOptionsDialog");
    setModal(true);
    QWidget *plainPage = new QWidget(this);
    setMainWidget(plainPage);

    QGridLayout *lyr = new QGridLayout(plainPage);

    QGroupBox* textEncodingGroupBox = new QGroupBox(i18n("Text encoding"), plainPage);
    lyr->addWidget(textEncodingGroupBox, 0, 0, 1, 2);
    QVBoxLayout* textEncodingGroupBoxLyr = new QVBoxLayout;
    KexiUtils::setStandardMarginsAndSpacing(textEncodingGroupBoxLyr);
    textEncodingGroupBox->setLayout(textEncodingGroupBoxLyr);

    textEncodingGroupBoxLyr->addItem(new QSpacerItem(20, 15, QSizePolicy::Fixed, QSizePolicy::Fixed));

    m_encodingComboBox = new KexiCharacterEncodingComboBox(textEncodingGroupBox, options.encoding);
    textEncodingGroupBoxLyr->addWidget(m_encodingComboBox);

    lyr->addItem(new QSpacerItem(20, KDialog::spacingHint(), QSizePolicy::Expanding, QSizePolicy::Minimum), 0, 2);

    m_chkAlwaysUseThisEncoding = new QCheckBox(
        i18n("Always use this encoding when importing CSV data files"), textEncodingGroupBox);
    textEncodingGroupBoxLyr->addWidget(m_chkAlwaysUseThisEncoding);

    m_comboDateFormat = new QComboBox(plainPage);
    m_comboDateFormat->setObjectName("m_comboDateFormat");
    m_comboDateFormat->addItem(i18nc("Date format: Auto", "Auto"));
    QString year(i18n("year")), month(i18n("month")), day(i18n("day"));
    QString mask(i18nc("do not reorder placeholders, just translate e.g. and - to the separator used by dates in your language", "%1, %2, %3 (e.g. %4-%5-%6)"));
    m_comboDateFormat->addItem(
        mask.arg(day).arg(month).arg(year).arg(30).arg(12).arg(2008));
    m_comboDateFormat->addItem(
        mask.arg(year).arg(month).arg(day).arg(2008).arg(12).arg(30));
    m_comboDateFormat->addItem(
        mask.arg(month).arg(day).arg(year).arg(12).arg(30).arg(2008));
    lyr->addWidget(m_comboDateFormat, 1, 1);

    QLabel* lblDateFormat = new QLabel(i18n("Date format:"), plainPage);
    lblDateFormat->setBuddy(m_comboDateFormat);
    lyr->addWidget(lblDateFormat, 1, 0);

    m_chkStripWhiteSpaceInTextValues = new QCheckBox(
        i18n("Strip leading and trailing blanks off of text values"), plainPage);
    lyr->addWidget(m_chkStripWhiteSpaceInTextValues, 2, 0, 1, 2);

    m_chkImportNULLsAsEmptyText = new QCheckBox(
                i18n("Import missing text values as empty texts"), plainPage);
    lyr->addWidget(m_chkImportNULLsAsEmptyText, 3, 0, 1, 2);
    lyr->addItem(new QSpacerItem(30, KDialog::spacingHint(), QSizePolicy::Minimum, QSizePolicy::Expanding), 4, 0);
    //update widgets
    m_encodingComboBox->setSelectedEncoding(options.encoding);
    if (options.defaultEncodingExplicitySet) {
        m_chkAlwaysUseThisEncoding->setChecked(true);
    }
    m_comboDateFormat->setCurrentIndex((int)options.dateFormat);
    m_chkStripWhiteSpaceInTextValues->setChecked(options.trimmedInTextValuesChecked);
    m_chkImportNULLsAsEmptyText->setChecked(options.nullsImportedAsEmptyTextChecked);

    adjustSize();
    m_encodingComboBox->setFocus();
}
AttachmentEditDialog::AttachmentEditDialog( AttachmentIconItem *item,
                                            QWidget *parent, bool modal )
  : KDialog ( parent ), mItem( item ), mURLRequester( 0 )
{
  // based loosely on KPropertiesDialog code
  QWidget *page = new QWidget(this);
  setMainWidget( page );
  setCaption( i18nc( "@title", "Properties for %1",
                     item->label().isEmpty() ? item->uri() : item->label() ) );
  setButtons( KDialog::Ok | KDialog::Cancel );
  setDefaultButton( KDialog::Ok );
  setModal( modal );
  QVBoxLayout *vbl = new QVBoxLayout( page );
  vbl->setSpacing( KDialog::spacingHint() );
  vbl->setMargin( 0 );
  QGridLayout *grid = new QGridLayout();
  grid->setColumnStretch( 0, 0 );
  grid->setColumnStretch( 1, 0 );
  grid->setColumnStretch( 2, 1 );
  grid->addItem( new QSpacerItem( KDialog::spacingHint(), 0 ), 0, 1 );
  vbl->addLayout( grid );

  mIcon = new QLabel( page );
  int bsize = 66 + 2 * mIcon->style()->pixelMetric( QStyle::PM_ButtonMargin );
  mIcon->setFixedSize( bsize, bsize );
  mIcon->setPixmap( item->icon() );
  grid->addWidget( mIcon, 0, 0, Qt::AlignLeft );

  mLabelEdit = new KLineEdit( page );
  mLabelEdit->setText( item->label().isEmpty() ? item->uri() : item->label() );
  mLabelEdit->setClickMessage( i18nc( "@label", "Attachment name" ) );
  mLabelEdit->setToolTip(
    i18nc( "@info:tooltip", "Give the attachment a name" ) );
  mLabelEdit->setWhatsThis(
    i18nc( "@info:whatsthis", "Type any string you desire here for the name of the attachment" ) );
  grid->addWidget( mLabelEdit, 0, 2 );

  KSeparator *sep = new KSeparator( Qt::Horizontal, page );
  grid->addWidget( sep, 1, 0, 1, 3 );

  QLabel *label = new QLabel( i18nc( "@label", "Type:" ), page );
  grid->addWidget( label, 2, 0 );
  QString typecomment = item->mimeType().isEmpty() ?
                        i18nc( "@label unknown mimetype", "Unknown" ) :
                        KMimeType::mimeType( item->mimeType() )->comment();
  mTypeLabel = new QLabel( typecomment, page );
  grid->addWidget( mTypeLabel, 2, 2 );
  mMimeType = KMimeType::mimeType( item->mimeType() );

  mInline = new QCheckBox( i18nc( "@option:check", "Store attachment inline" ), page );
  grid->addWidget( mInline, 3, 0, 1, 3 );
  mInline->setChecked( item->isBinary() );
  mInline->setToolTip(
    i18nc( "@info:tooltip", "Store the attachment file inside the calendar" ) );
  mInline->setWhatsThis(
    i18nc( "@info:whatsthis",
           "Checking this option will cause the attachment to be stored inside "
           "your calendar, which can take a lot of space depending on the size "
           "of the attachment. If this option is not checked, then only a link "
           "pointing to the attachment will be stored.  Do not use a link for "
           "attachments that change often or may be moved (or removed) from "
           "their current location." ) );

  if ( item->attachment()->isUri() ) {
    label = new QLabel( i18nc( "@label", "Location:" ), page );
    grid->addWidget( label, 4, 0 );
    mURLRequester = new KUrlRequester( item->uri(), page );
    mURLRequester->setToolTip(
      i18nc( "@info:tooltip", "Provide a location for the attachment file" ) );
    mURLRequester->setWhatsThis(
      i18nc( "@info:whatsthis",
             "Enter the path to the attachment file or use the file browser "
             "by pressing the adjacent button" ) );
    grid->addWidget( mURLRequester, 4, 2 );
    connect( mURLRequester, SIGNAL(urlSelected(const KUrl &)),
             SLOT(urlChanged(const KUrl &)) );
    connect( mURLRequester, SIGNAL( textChanged( const QString& ) ),
             SLOT( urlChanged( const QString& ) ) );
    urlChanged( item->uri() );
  } else {
    grid->addWidget( new QLabel( i18nc( "@label", "Size:" ), page ), 4, 0 );
    grid->addWidget( new QLabel( QString::fromLatin1( "%1 (%2)" ).
                                 arg( KIO::convertSize( item->attachment()->size() ) ).
                                 arg( KGlobal::locale()->formatNumber(
                                        item->attachment()->size(), 0 ) ), page ), 4, 2 );
  }
  vbl->addStretch( 10 );
}
Exemple #11
0
EditACLEntryDialog::EditACLEntryDialog( KACLListView *listView, KACLListViewItem *item,
                                        const QStringList &users,
                                        const QStringList &groups,
                                        const QStringList &defaultUsers,
                                        const QStringList &defaultGroups,
                                        int allowedTypes, int allowedDefaultTypes,
                                        bool allowDefaults )
    : KDialog( listView ),
      m_listView( listView ), m_item( item ), m_users( users ), m_groups( groups ),
      m_defaultUsers( defaultUsers ), m_defaultGroups( defaultGroups ),
      m_allowedTypes( allowedTypes ), m_allowedDefaultTypes( allowedDefaultTypes ),
      m_defaultCB( 0 )
{
    setObjectName( "edit_entry_dialog" );
    setModal( true );
    setCaption( i18n( "Edit ACL Entry" ) );
    setButtons( KDialog::Ok | KDialog::Cancel );
    setDefaultButton( KDialog::Ok );

    QWidget *page = new QWidget(  this );
    setMainWidget( page );
    QVBoxLayout *mainLayout = new QVBoxLayout( page );
    mainLayout->setMargin( 0 );
    QGroupBox *gb = new QGroupBox( i18n("Entry Type"), page );
    QVBoxLayout *gbLayout = new QVBoxLayout( gb );

    m_buttonGroup = new QButtonGroup( page );

    if ( allowDefaults ) {
        m_defaultCB = new QCheckBox( i18n("Default for new files in this folder"), page );
        m_defaultCB->setObjectName( QLatin1String( "defaultCB" ) );
        mainLayout->addWidget( m_defaultCB );
        connect( m_defaultCB, SIGNAL( toggled( bool ) ),
                 this, SLOT( slotUpdateAllowedUsersAndGroups() ) );
        connect( m_defaultCB, SIGNAL( toggled( bool ) ),
                 this, SLOT( slotUpdateAllowedTypes() ) );
    }

    QRadioButton *ownerType = new QRadioButton( i18n("Owner"), gb );
    ownerType->setObjectName( QLatin1String( "ownerType" ) );
    gbLayout->addWidget( ownerType );
    m_buttonGroup->addButton( ownerType );
    m_buttonIds.insert( ownerType, KACLListView::User );
    QRadioButton *owningGroupType = new QRadioButton( i18n("Owning Group"), gb );
    owningGroupType->setObjectName( QLatin1String( "owningGroupType" ) );
    gbLayout->addWidget( owningGroupType );
    m_buttonGroup->addButton( owningGroupType );
    m_buttonIds.insert( owningGroupType, KACLListView::Group );
    QRadioButton *othersType = new QRadioButton( i18n("Others"), gb );
    othersType->setObjectName( QLatin1String( "othersType" ) );
    gbLayout->addWidget( othersType );
    m_buttonGroup->addButton( othersType );
    m_buttonIds.insert( othersType, KACLListView::Others );
    QRadioButton *maskType = new QRadioButton( i18n("Mask"), gb );
    maskType->setObjectName( QLatin1String( "maskType" ) );
    gbLayout->addWidget( maskType );
    m_buttonGroup->addButton( maskType );
    m_buttonIds.insert( maskType, KACLListView::Mask );
    QRadioButton *namedUserType = new QRadioButton( i18n("Named user"), gb );
    namedUserType->setObjectName( QLatin1String( "namesUserType" ) );
    gbLayout->addWidget( namedUserType );
    m_buttonGroup->addButton( namedUserType );
    m_buttonIds.insert( namedUserType, KACLListView::NamedUser );
    QRadioButton *namedGroupType = new QRadioButton( i18n("Named group"), gb );
    namedGroupType->setObjectName( QLatin1String( "namedGroupType" ) );
    gbLayout->addWidget( namedGroupType );
    m_buttonGroup->addButton( namedGroupType );
    m_buttonIds.insert( namedGroupType, KACLListView::NamedGroup );

    mainLayout->addWidget( gb );

    connect( m_buttonGroup, SIGNAL( buttonClicked( QAbstractButton* ) ),
             this, SLOT( slotSelectionChanged( QAbstractButton * ) ) );

    m_widgetStack = new QStackedWidget( page );
    mainLayout->addWidget( m_widgetStack );

    KHBox *usersBox = new KHBox( m_widgetStack );
    m_widgetStack->addWidget( usersBox );

    KHBox *groupsBox = new KHBox( m_widgetStack );
    m_widgetStack->addWidget( groupsBox );

    QLabel *usersLabel = new QLabel( i18n( "User: "******"users" ) );
    usersLabel->setBuddy( m_usersCombo );

    QLabel *groupsLabel = new QLabel( i18n( "Group: " ), groupsBox );
    m_groupsCombo = new KComboBox( groupsBox );
    m_groupsCombo->setEditable( false );
    m_groupsCombo->setObjectName( QLatin1String( "groups" ) );
    groupsLabel->setBuddy( m_groupsCombo );

    if ( m_item ) {
        m_buttonIds.key( m_item->type )->setChecked( true );
        if ( m_defaultCB )
            m_defaultCB->setChecked( m_item->isDefault );
        slotUpdateAllowedTypes();
        slotSelectionChanged( m_buttonIds.key( m_item->type ) );
        slotUpdateAllowedUsersAndGroups();
        if ( m_item->type == KACLListView::NamedUser ) {
            m_usersCombo->setItemText( m_usersCombo->currentIndex(), m_item->qualifier );
        } else if ( m_item->type == KACLListView::NamedGroup ) {
            m_groupsCombo->setItemText( m_groupsCombo->currentIndex(), m_item->qualifier );
        }
    } else {
        // new entry, preselect "named user", arguably the most common one
        m_buttonIds.key( KACLListView::NamedUser )->setChecked( true );
        slotUpdateAllowedTypes();
        slotSelectionChanged( m_buttonIds.key( KACLListView::NamedUser ) );
        slotUpdateAllowedUsersAndGroups();
    }
    incrementInitialSize(  QSize( 100, 0 ) );
    connect(this,SIGNAL(okClicked()), this, SLOT(slotOk()));
}
Exemple #12
0
/*
	InputDialog
*/
InputDialog::InputDialog(const QString &caption, uint options, const QStringList& history, const QString& hint, const QString& alter, KileInfo *ki, QWidget *parent, const char *name)
	: KDialog (parent), m_ki(ki)
{
	setModal(true);
	setButtons(Ok | Cancel);
	setDefaultButton(Ok);
	showButtonSeparator(true);
	setObjectName(name);

	QString newcaption = caption;
	setCaption(newcaption.remove('&'));

	m_labelprefix = ( newcaption == "chapter" ) ? "chap:" : "sec:";

	m_usedSelection = false;

	QWidget *page = new QWidget(this);
	setMainWidget(page);
	QGridLayout *gbox = new QGridLayout(page);

	QLabel *lb = new QLabel(hint, page);
	gbox->addWidget(lb, 0, 0, 1, 3);

	m_tag.clear();
	QWidget *focus;
	if((options & KileAction::KeepHistory) || (options & KileAction::FromLabelList) || (options & KileAction::FromBibItemList)) {
		KComboBox *input = new KComboBox(true, page);
		input->setObjectName("input_dialog_input");
		input->setCompletionMode(KGlobalSettings::CompletionAuto);
		input->setMinimumWidth(300);
		focus = input;

		connect(input, SIGNAL(textChanged(const QString&)), this, SLOT(setTag(const QString&)));
		connect(this,  SIGNAL(setInput(const QString&)), input, SLOT(setEditText(const QString&)));
		if(options & KileAction::ShowBrowseButton) {
			gbox->addWidget(input, 1, 0);
		}
		else {
			gbox->addWidget(input, 1, 0, 1, 3);
		}

		QStringList list;

		if(options & KileAction::FromLabelList) {
			list = ki->allLabels();
			if(list.size() > 0) {
				input->addItems(list);
				m_tag = list.first();
			}
		}
		else if(options & KileAction::FromBibItemList) {
			list = ki->allBibItems();
			if(list.size() > 0) {
				input->addItems(list);
				m_tag = list.first();
			}
		}
		else {
			if(history.size() > 0){
				input->addItems(history);
				m_tag = history.first();
			}
		}
	}
Exemple #13
0
PrefDialog::PrefDialog(QWidget *parent,int nbChannels)
 : QPageDialog(parent)
{

    setButtons(Help | Default | Ok | Apply | Cancel);
    setDefaultButton(Ok);
    setFaceType(List);
    setWindowTitle(tr("Preferences"));

    setHelp("settings","klusters");
    
    QWidget * w = new QWidget(this);
    prefGeneral = new PrefGeneral(w);
    QPageWidgetItem *item = new QPageWidgetItem(prefGeneral,tr("General"));
    item->setHeader(tr("Klusters General Configuration"));
    item->setIcon(QIcon(":/shared-icons/folder-open"));


    addPage(item);



    //adding page "Cluster view configuration"
    w = new QWidget(this);
    prefclusterView = new PrefClusterView(w);

    item = new QPageWidgetItem(prefclusterView,tr("Cluster view"));
    item->setHeader(tr("Cluster View configuration"));
    item->setIcon(QIcon(":/icons/clusterview"));
    addPage(item);


    //adding page "Waveform view configuration"
    w = new QWidget(this);
    prefWaveformView = new PrefWaveformView(w,nbChannels);

    item = new QPageWidgetItem(prefWaveformView,tr("Waveform view"));
    item->setHeader(tr("Waveform View configuration"));
    item->setIcon(QIcon(":/icons/waveformview"));
    addPage(item);



    // connect interactive widgets and selfmade signals to the enableApply slotDefault
    connect(prefGeneral->crashRecoveryCheckBox,SIGNAL(clicked()),this,SLOT(enableApply()));
    connect(prefGeneral->crashRecoveryComboBox,SIGNAL(activated(int)),this,SLOT(enableApply()));
    connect(prefGeneral->undoSpinBox,SIGNAL(valueChanged(int)),this,SLOT(enableApply()));
    connect(prefGeneral->backgroundColorButton,SIGNAL(colorChanged(QColor)),this,SLOT(enableApply()));
    connect(prefGeneral->reclusteringExecutableLineEdit,SIGNAL(textChanged(QString)),this,SLOT(enableApply()));
    //connect(prefGeneral,SIGNAL(reclusteringArgsUpdate()),this,SLOT(enableApply()));
    connect(prefGeneral->reclusteringArgsLineEdit,SIGNAL(textChanged(QString)),this,SLOT(enableApply()));
    connect(prefGeneral->useWhiteColorPrinting,SIGNAL(clicked()),this,SLOT(enableApply()));
    
    connect(prefclusterView->intervalSpinBox,SIGNAL(valueChanged(int)),this,SLOT(enableApply()));
    connect(prefWaveformView->gainSpinBox,SIGNAL(valueChanged(int)),this,SLOT(enableApply()));
    connect(prefWaveformView,SIGNAL(positionsChanged()),this,SLOT(enableApply()));


    connect(this, SIGNAL(applyClicked()), SLOT(slotApply()));
    connect(this, SIGNAL(defaultClicked()), SLOT(slotDefault()));
    connect(this,SIGNAL(helpClicked()),SLOT(slotHelp()));

    applyEnable = false;
}
Exemple #14
0
K3bInteractionDialog::K3bInteractionDialog( QWidget* parent,
					    const char* name,
					    const QString& title,
					    const QString& subTitle,
					    int buttonMask,
					    int defaultButton,
					    const QString& configGroup,
					    bool modal,
					    WFlags fl )
  : KDialog( parent, name, modal, fl ),
    m_mainWidget(0),
    m_defaultButton(defaultButton),
    m_configGroup(configGroup),
    m_exitLoopOnHide(true),
    m_inLoop(false),
    m_inToggleMode(false),
    m_delayedInit(false)
{
  installEventFilter( this );

  mainGrid = new QGridLayout( this );
  mainGrid->setSpacing( spacingHint() );
  mainGrid->setMargin( marginHint() );

  // header
  // ---------------------------------------------------------------------------------------------------
  m_dialogHeader = new K3bThemedHeader( this );
  mainGrid->addMultiCellWidget( m_dialogHeader, 0, 0, 0, 2 );


  // settings buttons
  // ---------------------------------------------------------------------------------------------------
  if( !m_configGroup.isEmpty() ) {
    QHBoxLayout* layout2 = new QHBoxLayout( 0, 0, spacingHint(), "layout2");
    m_buttonLoadSettings = new K3bToolButton( /*i18n("User Defaults"), */this );
    ((K3bToolButton*)m_buttonLoadSettings)->setIconSet( SmallIconSet( "revert" ) );
    QPopupMenu* userDefaultsPopup = new QPopupMenu( m_buttonLoadSettings );
    userDefaultsPopup->insertItem( i18n("Load default settings"), this, SLOT(slotLoadK3bDefaults()) );
    userDefaultsPopup->insertItem( i18n("Load saved settings"), this, SLOT(slotLoadUserDefaults()) );
    userDefaultsPopup->insertItem( i18n("Load last used settings"), this, SLOT(slotLoadLastSettings()) );
    ((QToolButton*)m_buttonLoadSettings)->setPopup( userDefaultsPopup );
    ((K3bToolButton*)m_buttonLoadSettings)->setInstantMenu( true );
    layout2->addWidget( m_buttonLoadSettings );

    m_buttonSaveSettings = new QToolButton( /*i18n("Save User Defaults"), */this, "m_buttonSaveSettings" );
    ((QToolButton*)m_buttonSaveSettings)->setIconSet( SmallIconSet( "filesave" ) );
    layout2->addWidget( m_buttonSaveSettings );

    mainGrid->addLayout( layout2, 2, 0 );
  }

  QSpacerItem* spacer = new QSpacerItem( 10, 10, QSizePolicy::Expanding, QSizePolicy::Minimum );
  mainGrid->addItem( spacer, 2, 1 );


  // action buttons
  // ---------------------------------------------------------------------------------------------------
  QHBoxLayout* layout5 = new QHBoxLayout( 0, 0, spacingHint(), "layout5");

  if( buttonMask & START_BUTTON ) {
    KGuiItem startItem = KStdGuiItem::ok();
    m_buttonStart = new KPushButton( startItem, this, "m_buttonStart" );
    // refine the button text
    setButtonText( START_BUTTON,
		   i18n("Start"),
		   i18n("Start the task") );
    QFont fnt( m_buttonStart->font() );
    fnt.setBold(true);
    m_buttonStart->setFont( fnt );
  }
  else
    m_buttonStart = 0;

  if( buttonMask & SAVE_BUTTON ) {
    m_buttonSave = new KPushButton( KStdGuiItem::save(), this, "m_buttonSave" );
  }
  else
    m_buttonSave = 0;

  if( buttonMask & CANCEL_BUTTON ) {
    m_buttonCancel = new KPushButton( KConfigGroup( k3bcore->config(), "General Options" )
				      .readBoolEntry( "keep action dialogs open", false )
				      ? KStdGuiItem::close()
				      : KStdGuiItem::cancel(),
				      this,
				      "m_buttonCancel" );
  }
  else
    m_buttonCancel = 0;

  // we only handle some of the possible settings since
  // our buttons are always to the right of the dialog
  int btl = 0;
#if KDE_IS_VERSION(3,3,0)
  btl = KGlobalSettings::buttonLayout();
#endif
  switch( btl ) {
  case 0: // KDE default
  default:
      if ( m_buttonStart )
          layout5->addWidget( m_buttonStart );
      if ( m_buttonSave )
          layout5->addWidget( m_buttonSave );
      if ( m_buttonCancel )
          layout5->addWidget( m_buttonCancel );
      break;

  case 1: // something different
      if ( m_buttonCancel )
          layout5->addWidget( m_buttonCancel );
      if ( m_buttonSave )
          layout5->addWidget( m_buttonSave );
      if ( m_buttonStart )
          layout5->addWidget( m_buttonStart );
      break;

  case 2: // GTK-Style
      if ( m_buttonSave )
          layout5->addWidget( m_buttonSave );
      if ( m_buttonCancel )
          layout5->addWidget( m_buttonCancel );
      if ( m_buttonStart )
          layout5->addWidget( m_buttonStart );
      break;
  }

  mainGrid->addLayout( layout5, 2, 2 );

  mainGrid->setRowStretch( 1, 1 );

  setTitle( title, subTitle );

  initConnections();
  initToolTipsAndWhatsThis();

  setDefaultButton( START_BUTTON );
}
Exemple #15
0
//BEGIN class LinkerOptionsDlg
LinkerOptionsDlg::LinkerOptionsDlg( LinkerOptions * linkingOptions, QWidget *parent )
	: // KDialog( parent, "Linker Options Dialog", true, "Linker Options", KDialog::Ok|KDialog::Cancel, KDialog::Ok, true )
	KDialog( parent) //, "Linker Options Dialog", true, "Linker Options", KDialog::Ok|KDialog::Cancel, KDialog::Ok, true )
{
    setObjectName("Linker Options Dialog");
    setModal(true);
    setCaption(i18n("Linker Options"));
    setButtons(KDialog::Ok|KDialog::Cancel);
    setDefaultButton(KDialog::Ok);
    showButtonSeparator(true);


	m_pLinkerOptions = linkingOptions;
	m_pWidget = new LinkerOptionsWidget(this);
	
	ProjectInfo * pi = ProjectManager::self()->currentProject();
	assert(pi);
	
	
	//BEGIN Update gplink options
	m_pWidget->m_pHexFormat->setCurrentIndex( m_pLinkerOptions->hexFormat() );
	m_pWidget->m_pOutputMap->setChecked( m_pLinkerOptions->outputMapFile() );
	m_pWidget->m_pLibraryDir->setText( m_pLinkerOptions->libraryDir() );
	m_pWidget->m_pLinkerScript->setText( m_pLinkerOptions->linkerScript() );
	m_pWidget->m_pOther->setText( m_pLinkerOptions->linkerOther() );
	//END Update gplink options
	
	
	
	//BEGIN Update library widgets
	const KUrl::List availableInternal = pi->childOutputURLs( ProjectItem::LibraryType );
	const QStringList linkedInternal = m_pLinkerOptions->linkedInternal();
	
	KUrl::List::const_iterator end = availableInternal.end();
	for ( KUrl::List::const_iterator it = availableInternal.begin(); it != end; ++it )
	{
		QString relativeURL = KUrl::relativeUrl( pi->url(), *it );
        // 2017.12.1 - convert to QListWidgetItem
		//Q3CheckListItem * item = new Q3CheckListItem( m_pWidget->m_pInternalLibraries, relativeURL, Q3CheckListItem::CheckBox );
        QListWidgetItem * item = new QListWidgetItem( relativeURL, m_pWidget->m_pInternalLibraries );
        item->setCheckState( (linkedInternal.contains(relativeURL)) ? Qt::Checked : Qt::Unchecked );
		//item->setOn( linkedInternal.contains(relativeURL) ); // 2017.12.1 - convert to QListWidgetItem
	}
	
	m_pExternalLibraryRequester = new KUrlRequester( 0l );
	m_pExternalLibraryRequester->fileDialog()->setUrl( KUrl( "/usr/share/sdcc/lib" ) );
	
	delete m_pWidget->m_pExternalLibraries;
	m_pWidget->m_pExternalLibraries = new KEditListBox( i18n("Link libraries outside project"), m_pExternalLibraryRequester->customEditor(), m_pWidget );
	m_pWidget->m_pExternalLibraries->layout()->setMargin(11);
    {
        QGridLayout* grLayout = (dynamic_cast<QGridLayout*>(m_pWidget->layout()));
        //grLayout->addMultiCellWidget( m_pWidget->m_pExternalLibraries, 7, 7, 0, 1 ); // 2018.12.02
        grLayout->addWidget( m_pWidget->m_pExternalLibraries, 7, 0, 1, 2);
    }
	
	m_pWidget->m_pExternalLibraries->setButtons( KEditListBox::Add | KEditListBox::Remove );
	m_pWidget->m_pExternalLibraries->insertStringList( m_pLinkerOptions->linkedExternal() );
	//END Update library widgets
	
	
	setMainWidget( m_pWidget );
	setInitialSize( m_pWidget->rect().size() );
}
MicroSettingsDlg::MicroSettingsDlg( MicroSettings * microSettings, QWidget *parent, const char *name )
	:
	//KDialog( parent, name, true, i18n("PIC Settings"), KDialog::Ok|KDialog::Apply|KDialog::Cancel, KDialog::Ok, true )
    KDialog( parent /*, name, true, i18n("PIC Settings"), KDialog::Ok|KDialog::Apply|KDialog::Cancel, KDialog::Ok, true */ )
{
    setName(name);
    setModal(true);
    setCaption(i18n("PIC Settings"));
    setButtons(KDialog::Ok | KDialog::Apply | KDialog::Cancel);
    setDefaultButton(KDialog::Ok);
    showButtonSeparator(true);

	m_pMicroSettings = microSettings;
	m_pNewPinMappingWidget = 0l;
	m_pNewPinMappingDlg = 0l;
	m_pWidget = new MicroSettingsWidget(this);
	
	QWhatsThis::add( this, i18n("This dialog allows editing of the initial properties of the PIC") );
	QWhatsThis::add( m_pWidget->portsGroupBox, i18n("Edit the initial value of the ports here. For each binary number, the order from right-to-left is pins 0 through 7.<br><br>The \"Type (TRIS)\" edit shows the initial input/output state of the ports; 1 represents an input, and 0 an output.<br><br>The \"State (PORT)\" edit shows the initial high/low state of the ports; 1 represents a high, and 0 a low.") );
	QWhatsThis::add( m_pWidget->variables, i18n("Edit the initial value of the variables here.<br><br>Note that the value of the variable can only be in the range 0->255. These variables will be initialized before any other code is executed.") );
	
	
	//BEGIN Initialize initial port settings
	m_portNames = microSettings->microInfo()->package()->portNames();
	
	m_portTypeEdit.resize( m_portNames.size(), 0 );
	m_portStateEdit.resize( m_portNames.size(), 0 );
	
	uint row = 0;
	QStringList::iterator end = m_portNames.end();
	for ( QStringList::iterator it = m_portNames.begin(); it != end; ++it, ++row )
	{
		//BEGIN Get current Type / State text
		QString portType = QString::number( microSettings->portType(*it), 2 );
		QString portState = QString::number( microSettings->portState(*it), 2 );

		QString fill;
		fill.fill( '0', 8-portType.length() );
		portType.prepend(fill);
		fill.fill( '0', 8-portState.length() );
		portState.prepend(fill);
		//END Get current Type / State text
		
		
		Q3GroupBox * groupBox = new Q3GroupBox( *it, m_pWidget->portsGroupBox );
		
		groupBox->setColumnLayout(0, Qt::Vertical );
		groupBox->layout()->setSpacing( 6 );
		groupBox->layout()->setMargin( 11 );
		QGridLayout * groupBoxLayout = new QGridLayout( groupBox->layout() );
		groupBoxLayout->setAlignment( Qt::AlignTop );
		
		// TODO: replace this with i18n( "the type", "Type (TRIS register):" );
		groupBoxLayout->addWidget( new QLabel( i18n("Type (TRIS register):"), groupBox ), 0, 0 ); 
		groupBoxLayout->addWidget( new QLabel( i18n("State (PORT register):"), groupBox ), 1, 0 );

		m_portTypeEdit[row] = new KLineEdit( portType, groupBox );
		groupBoxLayout->addWidget( m_portTypeEdit[row], 0, 1 );

		m_portStateEdit[row] = new KLineEdit( portState, groupBox );
		groupBoxLayout->addWidget( m_portStateEdit[row], 1, 1 );

// 		(dynamic_cast<QVBoxLayout*>(m_pWidget->portsGroupBox->layout()))->insertWidget( row, groupBox );
		(dynamic_cast<QVBoxLayout*>(m_pWidget->portsGroupBox->layout()))->addWidget( groupBox );
	}
	//END Initialize initial port settings
	
	
	
	//BEGIN Initialize initial variable settings
	// Hide row headers
	m_pWidget->variables->setLeftMargin(0);
	
	// Make columns as thin as possible
	m_pWidget->variables->setColumnStretchable( 0, true );
	m_pWidget->variables->setColumnStretchable( 1, true );
	
	QStringList variables = microSettings->variableNames();
	row = 0;
	end = variables.end();
	for ( QStringList::iterator it = variables.begin(); it != end; ++it )
	{
		VariableInfo *info = microSettings->variableInfo(*it);
		if (info)
		{
			m_pWidget->variables->insertRows( row, 1 );
			m_pWidget->variables->setText( row, 0,  *it );
			m_pWidget->variables->setText( row, 1, info->valueAsString() );
			++row;
		}
	}
	m_pWidget->variables->insertRows( row, 1 );
	
	connect( m_pWidget->variables, SIGNAL(valueChanged(int,int)), this, SLOT(checkAddVariableRow()) );
	//END Initialize initial variable settings
	
	
	
	//BEGIN Initialize pin maps
	connect( m_pWidget->pinMapAdd, SIGNAL(clicked()), this, SLOT(slotCreatePinMap()) );
	connect( m_pWidget->pinMapModify, SIGNAL(clicked()), this, SLOT(slotModifyPinMap()) );
	connect( m_pWidget->pinMapRename, SIGNAL(clicked()), this, SLOT(slotRenamePinMap()) );
	connect( m_pWidget->pinMapRemove, SIGNAL(clicked()), this, SLOT(slotRemovePinMap()) );
	
	m_pinMappings = microSettings->pinMappings();
	m_pWidget->pinMapCombo->insertStringList( m_pinMappings.keys() );
	
	updatePinMapButtons();
	//END Initialize pin maps
	
	
	//enableButtonSeparator( false );
    showButtonSeparator( false );
	setMainWidget(m_pWidget);
	m_pWidget->adjustSize();
	adjustSize();
	
	connect( this, SIGNAL(applyClicked()), this, SLOT(slotSaveStuff()) );
}
Exemple #17
0
void WMessageBox::setDefaultButton(StandardButton button)
{
  WPushButton *b = this->button(button);
  if (b)
    setDefaultButton(b);
}
KJotsLinkDialog::KJotsLinkDialog( QAbstractItemModel *kjotsModel, QWidget *parent)
  : KDialog(parent), m_kjotsModel(kjotsModel)
{
    setCaption(i18n("Manage Link"));
    setButtons(Ok | Cancel);
    setDefaultButton(Ok);
    setModal(true);
    showButtonSeparator(true);

    KDescendantsProxyModel *proxyModel = new KDescendantsProxyModel( this );
    proxyModel->setSourceModel( kjotsModel );
    proxyModel->setAncestorSeparator( QLatin1String( " / " ) );

    m_descendantsProxyModel = proxyModel;

    QWidget *entries = new QWidget(this);

    QGridLayout *layout = new QGridLayout(entries);

    textLabel = new QLabel(i18n("Link Text:"), this);
    textLineEdit = new KLineEdit(this);
    textLineEdit->setClearButtonShown(true);
    linkUrlLabel = new QLabel(i18n("Link URL:"), this);
    linkUrlLineEdit = new KLineEdit(this);
    hrefCombo = new KComboBox(this);
    linkUrlLineEdit->setClearButtonShown(true);

    tree = new QTreeView();
    tree->setModel(proxyModel);
    tree->expandAll();
    tree->setColumnHidden(1, true);
    hrefCombo->setModel(proxyModel);
    hrefCombo->setView(tree);

    hrefCombo->setEditable(true);
    QCompleter *completer = new QCompleter(proxyModel, this);
    completer->setCaseSensitivity(Qt::CaseInsensitive);
    hrefCombo->setCompleter(completer);
    KJotsBookshelfEntryValidator* validator = new KJotsBookshelfEntryValidator( proxyModel, this );
    hrefCombo->setValidator( validator );

    QGridLayout* linkLayout = new QGridLayout();
    linkUrlLineEditRadioButton = new QRadioButton(entries);
    hrefComboRadioButton = new QRadioButton(entries);

    connect(linkUrlLineEditRadioButton, SIGNAL(toggled(bool)),
        linkUrlLineEdit, SLOT(setEnabled(bool)));
    connect(hrefComboRadioButton, SIGNAL(toggled(bool)),
        hrefCombo, SLOT(setEnabled(bool)));
    hrefCombo->setEnabled(false);
    linkUrlLineEditRadioButton->setChecked(true);

    linkLayout->addWidget(linkUrlLineEditRadioButton, 0, 0);
    linkLayout->addWidget(linkUrlLineEdit, 0, 1);
    linkLayout->addWidget(hrefComboRadioButton, 1, 0);
    linkLayout->addWidget(hrefCombo, 1, 1);

    layout->addWidget(textLabel, 0, 0);
    layout->addWidget(textLineEdit, 0, 1);
    layout->addWidget(linkUrlLabel, 1, 0);
    layout->addLayout( linkLayout, 1, 1 );

    setMainWidget(entries);

    textLineEdit->setFocus();

    connect( hrefCombo, SIGNAL(editTextChanged(QString)),
        this, SLOT(trySetEntry(QString)) );
}
GeoDialog::GeoDialog( QWidget *parent )
  : KDialog( parent ),
    mUpdateSexagesimalInput( true )
{
  setCaption( i18nc( "@title:window", "Geo Data Input" ) );
  setButtons( Ok | Cancel );
  setDefaultButton( Ok );
  showButtonSeparator( true );
  setModal( true );

  QFrame *page = new QFrame(this);
  setMainWidget( page );

  QGridLayout *topLayout = new QGridLayout( page );
  topLayout->setSpacing( spacingHint() );
  topLayout->setMargin( 0 );
  topLayout->setRowStretch( 1, 1 );

  mMapWidget = new GeoMapWidget( page );
  topLayout->addWidget( mMapWidget, 0, 0, 2, 1);

  mCityCombo = new KComboBox( page );
  topLayout->addWidget( mCityCombo, 0, 1 );

  QGroupBox *sexagesimalGroup = new QGroupBox( i18nc( "@title:group", "Sexagesimal" ), page );
  QGridLayout *sexagesimalLayout = new QGridLayout();
  sexagesimalGroup->setLayout( sexagesimalLayout );
  sexagesimalLayout->setSpacing( spacingHint() );

  QLabel *label = new QLabel( i18nc( "@label:spinbox", "Latitude:" ), sexagesimalGroup );
  sexagesimalLayout->addWidget( label, 0, 0 );

  mLatDegrees = new QSpinBox( sexagesimalGroup );
  mLatDegrees->setMinimum( 0 );
  mLatDegrees->setMaximum( 90 );
  mLatDegrees->setValue( 1 );
  mLatDegrees->setSuffix( QString::fromUtf8( "°" ) );
  mLatDegrees->setWrapping( false );
  label->setBuddy( mLatDegrees );
  sexagesimalLayout->addWidget( mLatDegrees, 0, 1 );

  mLatMinutes = new QSpinBox( sexagesimalGroup );
  mLatMinutes->setMinimum( 0 );
  mLatMinutes->setMaximum( 59 );
  mLatMinutes->setValue( 1 );

  mLatMinutes->setSuffix( "'" );
  sexagesimalLayout->addWidget( mLatMinutes, 0, 2 );

  mLatSeconds = new QSpinBox( sexagesimalGroup );
  mLatSeconds->setMinimum( 0 );
  mLatSeconds->setMaximum( 59 );
  mLatSeconds->setValue( 1 );
  mLatSeconds->setSuffix( "\"" );
  sexagesimalLayout->addWidget( mLatSeconds, 0, 3 );

  mLatDirection = new KComboBox( sexagesimalGroup );
  mLatDirection->addItem( i18nc( "@item:inlistbox Latitude direction", "North" ) );
  mLatDirection->addItem( i18nc( "@item:inlistbox Latitude direction", "South" ) );
  sexagesimalLayout->addWidget( mLatDirection, 0, 4 );

  label = new QLabel( i18nc( "@label:spinbox", "Longitude:" ), sexagesimalGroup );
  sexagesimalLayout->addWidget( label, 1, 0 );

  mLongDegrees = new QSpinBox( sexagesimalGroup );
  mLongDegrees->setMinimum( 0 );
  mLongDegrees->setMaximum( 180 );
  mLongDegrees->setValue( 1 );
  mLongDegrees->setSuffix( QString::fromUtf8( "°" ) );
  label->setBuddy( mLongDegrees );
  sexagesimalLayout->addWidget( mLongDegrees, 1, 1 );

  mLongMinutes = new QSpinBox( sexagesimalGroup );
  mLongMinutes->setMinimum( 0 );
  mLongMinutes->setMaximum( 59 );
  mLongMinutes->setValue( 1 );
  mLongMinutes->setSuffix( "'" );
  sexagesimalLayout->addWidget( mLongMinutes, 1, 2 );

  mLongSeconds = new QSpinBox( sexagesimalGroup );
  mLongSeconds->setMinimum( 0 );
  mLongSeconds->setMaximum( 59 );
  mLongSeconds->setValue( 1 );
  mLongSeconds->setSuffix( "\"" );
  sexagesimalLayout->addWidget( mLongSeconds, 1, 3 );

  mLongDirection = new KComboBox( sexagesimalGroup );
  mLongDirection->addItem( i18nc( "@item:inlistbox Longtitude direction", "East" ) );
  mLongDirection->addItem( i18nc( "@item:inlistbox Longtitude direction", "West" ) );
  sexagesimalLayout->addWidget( mLongDirection, 1, 4 );

  topLayout->addWidget( sexagesimalGroup, 1, 1 );

  loadCityList();

  connect( mMapWidget, SIGNAL( changed() ),
           SLOT( geoMapChanged() ) );
  connect( mCityCombo, SIGNAL( activated( int ) ),
           SLOT( cityInputChanged() ) );
  connect( mLatDegrees, SIGNAL( valueChanged( int ) ),
           SLOT( sexagesimalInputChanged() ) );
  connect( mLatMinutes, SIGNAL( valueChanged( int ) ),
           SLOT( sexagesimalInputChanged() ) );
  connect( mLatSeconds, SIGNAL( valueChanged( int ) ),
           SLOT( sexagesimalInputChanged() ) );
  connect( mLatDirection, SIGNAL( activated( int ) ),
           SLOT( sexagesimalInputChanged() ) );
  connect( mLongDegrees, SIGNAL( valueChanged( int ) ),
           SLOT( sexagesimalInputChanged() ) );
  connect( mLongMinutes, SIGNAL( valueChanged( int ) ),
           SLOT( sexagesimalInputChanged() ) );
  connect( mLongSeconds, SIGNAL( valueChanged( int ) ),
           SLOT( sexagesimalInputChanged() ) );
  connect( mLongDirection, SIGNAL( activated( int ) ),
           SLOT( sexagesimalInputChanged() ) );

  KAcceleratorManager::manage( this );
}
EditFilterDialog::EditFilterDialog( QWidget* parent, const QString &text )
    : KDialog( parent )
    , m_appended( false )
    , m_filterText( text )
{
    setCaption( i18n( "Edit Filter" ) );
    setModal( true );
    setButtons( User1|User2|Default|Ok|Cancel );
    setDefaultButton( Cancel );
    showButtonSeparator( true );
    m_ui.setupUi( mainWidget() );

    // Redefine "Default" button
    KGuiItem defaultButton( i18n("&Append"), "list-add" );
    setButtonWhatsThis( Default, i18n( "<qt><p>By clicking here you can add the defined condition. The \"OK\" button will "
                                        "close the dialog and apply the defined filter. With this button you can add more than "
                                        "one condition to create a more complex filtering condition.</p></qt>" ) );
    setButtonToolTip( Default, i18n( "Add this filter condition to the list" ) );
    setButtonGuiItem( Default, defaultButton );

    // define "User1" button
    KGuiItem user1Button( i18n("&Clear"), "list-remove" );
    setButtonWhatsThis( User1, i18n( "<p>By clicking here you will clear the filter. If you intend to "
                                     "undo the last appending just click on the \"Undo\" button.</p>" ) );
    setButtonToolTip(User1, i18n( "Clear the filter" ) );
    setButtonGuiItem( User1, user1Button );

    // define "User2" button
    KGuiItem user2Button( i18nc("this \"undo\" will undo the last appended filter... be careful how you will translate it "
       "to avoid two buttons (\"Cancel\" and \"Undo\") with same label in the same dialog", "&Undo"), "edit-undo" );
    setButtonWhatsThis( User2, i18n( "<p>Clicking here will remove the last appended filter. "
                "You cannot undo more than one action.</p>" ) );
    setButtonToolTip( User2, i18n( "Remove last appended filter" ) );
    setButtonGuiItem( User2, user2Button );
    
    //setMainWidget( m_ui );
        
    m_vector.push_back( "Simple Search" );
    m_vector.push_back( "album" );
    m_vector.push_back( "artist" );
    m_vector.push_back( "composer" );
    m_vector.push_back( "genre" );
    m_vector.push_back( "title" );
    m_vector.push_back( "track" );
    m_vector.push_back( "year" );

    // the "Simple Search" text is selected in the comboKeyword
    m_selectedIndex = 0;
    
    
    connect( m_ui.keywordCombo, SIGNAL( activated( int ) ), SLOT(selectedKeyword( int ) ) );

    connect( m_ui.minimum1, SIGNAL( valueChanged( int ) ), SLOT(minSpinChanged( int ) ) );
    connect( m_ui.maximum1, SIGNAL( valueChanged( int ) ), SLOT(maxSpinChanged( int ) ) );

    // type text selected
    textWanted();

    // check the "One Value Choosing" by default
    chooseOneValue();

    connect( m_ui.conditionCombo, SIGNAL(activated( int ) ), SLOT(chooseCondition( int ) ) );

    m_checkActions << m_ui.matchAll;
    m_checkActions << m_ui.matchAny;
    m_checkActions << m_ui.matchLiteral;
    m_checkActions << m_ui.matchNot;

    connect( m_ui.matchAll,     SIGNAL( clicked() ), SLOT( slotCheckAll() ) );
    connect( m_ui.matchAny,     SIGNAL( clicked() ), SLOT( slotCheckAtLeastOne() ) );
    connect( m_ui.matchLiteral, SIGNAL( clicked() ), SLOT( slotCheckExactly() ) );
    connect( m_ui.matchNot,     SIGNAL( clicked() ), SLOT( slotCheckExclude() ) );

    // check "select all words" as default
    slotCheckAll();

    m_ui.invertButton->setEnabled( false );

    connect( m_ui.invertButton, SIGNAL( clicked() ), SLOT( assignPrefixNOT() ) );

    // you need to append at least one filter condition to specify if do
    // an "AND" or an "OR" with the next condition if the filter is empty
    if( m_filterText.isEmpty() )
      m_ui.groupBox_3->setEnabled( false );

    connect( m_ui.andButton, SIGNAL(clicked()), SLOT(slotCheckAND()) );
    connect( m_ui.orButton, SIGNAL(clicked()), SLOT(slotCheckOR()) );

    // check "AND" condition as default
    slotCheckAND();

    connect( this, SIGNAL(okClicked()), this, SLOT(slotOk() ) );
    connect( this, SIGNAL( defaultClicked() ) , this, SLOT(slotDefault() ) );
    connect( this, SIGNAL( user1Clicked() ), this, SLOT( slotUser1() ) );
    connect( this, SIGNAL( user2Clicked() ), this, SLOT( slotUser2() ) );
    
    Amarok::Collection *coll = CollectionManager::instance()->primaryCollection();
    if( !coll )
        return;

    QueryMaker *artist = coll->queryMaker()->setQueryType( QueryMaker::Artist );
    QueryMaker *album = coll->queryMaker()->setQueryType( QueryMaker::Album );
    QueryMaker *composer = coll->queryMaker()->setQueryType( QueryMaker::Composer );
    QueryMaker *genre = coll->queryMaker()->setQueryType( QueryMaker::Genre );
    QList<QueryMaker*> queries;
    queries << artist << album << composer << genre;

    //MetaQueryMaker will run multiple different queries just fine as long as we do not use it
    //to set the query type. Configuring the queries is ok though

    MetaQueryMaker *dataQueryMaker = new MetaQueryMaker( queries );
    connect( dataQueryMaker, SIGNAL( newResultReady( QString, Meta::ArtistList ) ), SLOT( resultReady( QString, Meta::ArtistList ) ), Qt::QueuedConnection );
    connect( dataQueryMaker, SIGNAL( newResultReady( QString, Meta::AlbumList ) ), SLOT( resultReady( QString, Meta::AlbumList ) ), Qt::QueuedConnection );
    connect( dataQueryMaker, SIGNAL( newResultReady( QString, Meta::ComposerList ) ), SLOT( resultReady( QString, Meta::ComposerList ) ), Qt::QueuedConnection );
    connect( dataQueryMaker, SIGNAL( newResultReady( QString, Meta::GenreList ) ), SLOT( resultReady( QString, Meta::GenreList ) ), Qt::QueuedConnection );
    dataQueryMaker->run();
    
}
AIMUserInfoDialog::AIMUserInfoDialog( Kopete::Contact *c, AIMAccount *acc, QWidget *parent )
	: KDialog( parent )
{
	setCaption( i18n( "User Information on %1" ,
	                  c->displayName() ) );
	setButtons( KDialog::Cancel | KDialog::Ok );
	
	setDefaultButton(KDialog::Ok);
	showButtonSeparator(true);
	kDebug(14200) << "for contact '" << c->contactId() << "'";

	m_contact = c;
	mAccount = acc;

	QWidget* w = new QWidget( this );
	mMainWidget = new Ui::AIMUserInfoWidget();
	mMainWidget->setupUi( w );
	setMainWidget( w );

	QObject::connect(this, SIGNAL(okClicked()), this, SLOT(slotSaveClicked()));
	QObject::connect(this, SIGNAL(user1Clicked()), this, SLOT(slotUpdateClicked()));
	QObject::connect(this, SIGNAL(cancelClicked()), this, SLOT(slotCloseClicked()));
	QObject::connect(c, SIGNAL(updatedProfile()), this, SLOT(slotUpdateProfile()));
	QObject::connect(c, SIGNAL(statusMessageChanged( Kopete::Contact* )), this, SLOT(slotUpdateProfile()));

	mMainWidget->txtScreenName->setText( c->contactId() );
	mMainWidget->txtNickName->setText( c->customName() );

	if(m_contact == mAccount->myself()) // edit own account profile
	{
		mMainWidget->lblWarnLevel->hide();
		mMainWidget->txtWarnLevel->hide();
		mMainWidget->lblIdleTime->hide();
		mMainWidget->txtIdleTime->hide();
		mMainWidget->lblOnlineSince->hide();
		mMainWidget->txtOnlineSince->hide();
		mMainWidget->txtAwayMessage->hide();
		mMainWidget->lblAwayMessage->hide();

		userInfoView=0L;
		mMainWidget->userInfoFrame->setFrameStyle(QFrame::NoFrame | QFrame::Plain);
		QVBoxLayout *l = new QVBoxLayout(mMainWidget->userInfoFrame);
		l->setContentsMargins( 0, 0, 0, 0 );
		userInfoEdit = new KTextEdit(QString(), mMainWidget->userInfoFrame);

		AIMMyselfContact* aimmc = dynamic_cast<AIMMyselfContact*>( c );
		if ( aimmc )
			userInfoEdit->setPlainText( aimmc->userProfile() );
		else
			userInfoEdit->setPlainText( QString() );

		setButtonText(Ok, i18n("&Save Profile"));
		showButton(User1, false);
		l->addWidget(userInfoEdit);
	}
	else
	{
		userInfoEdit=0L;
		mMainWidget->userInfoFrame->setFrameStyle(QFrame::NoFrame | QFrame::Plain);
		QVBoxLayout *l = new QVBoxLayout(mMainWidget->userInfoFrame);
		l->setContentsMargins( 0, 0, 0, 0 );
		userInfoView = new KTextBrowser(mMainWidget->userInfoFrame);
		userInfoView->setObjectName("userInfoView");
		userInfoView->setNotifyClick(true);
		QObject::connect(
			userInfoView, SIGNAL(urlClick(QString)),
			this, SLOT(slotUrlClicked(QString)));
		QObject::connect(
			userInfoView, SIGNAL(mailClick(QString,QString)),
			this, SLOT(slotMailClicked(QString,QString)));
		showButton(Cancel, false);
		setButtonText(Ok, i18n("&Close"));
		setEscapeButton(Ok);
		l->addWidget(userInfoView);

		if(m_contact->isOnline())
		{
			// Update the user view to indicate that we're requesting the user's profile
			userInfoView->setPlainText(i18n("Requesting User Profile, please wait..."));
		}
		QTimer::singleShot(0, this, SLOT(slotUpdateProfile()));
	}
}
Exemple #22
0
Scanner::Scanner (QString n, DBIndex *i) : QTabDialog (0, 0, FALSE)
{
  chartIndex = i;
  scannerName = n;
  
  QString s = "Qtstalker Scanner";
  s.append(": ");
  s.append(scannerName);
  setCaption (s);

  QWidget *w = new QWidget(this);
  
  QVBoxLayout *vbox = new QVBoxLayout(w);
  vbox->setMargin(5);
  vbox->setSpacing(5);
  
  QHGroupBox *gbox = new QHGroupBox(tr("Symbol Selection"), w);  
  vbox->addWidget(gbox);

  allSymbols = new QCheckBox(tr("All symbols"), gbox);
  connect(allSymbols, SIGNAL(toggled(bool)), this, SLOT(allSymbolsToggled(bool)));

  fileButton = new QPushButton(tr("0 Symbols"), gbox);
  connect(fileButton, SIGNAL(clicked()), this, SLOT(getSymbols()));

  basePath = new QComboBox(gbox);
  basePath->insertItem(tr("Chart"), -1);
  basePath->insertItem(tr("Group"), -1);

  QGridLayout *grid = new QGridLayout(vbox, 1, 2);
  grid->setColStretch(1, 1);

  QLabel *label = new QLabel(tr("Bar Length"), w);
  grid->addWidget(label, 0, 0);

  BarData bd(scannerName);
  period = new QComboBox(w);
  bd.getBarLengthList(barLengthList);
  period->insertStringList(barLengthList, -1);
  period->setCurrentText("Daily");
  grid->addWidget(period, 0, 1);

  label = new QLabel(tr("Bars"), w);
  grid->addWidget(label, 1, 0);

  bars = new QSpinBox(1, 99999999, 1, w);
  bars->setValue(100);
  grid->addWidget(bars, 1, 1);
  
  list = new FormulaEdit(w, FormulaEdit::Logic);
  vbox->addWidget(list);
  
  setDefaultButton(tr("&Scan"));
  connect(this, SIGNAL(defaultButtonPressed()), this, SLOT(scan()));
  
  setApplyButton(tr("&Apply"));  
  connect(this, SIGNAL(applyButtonPressed()), this, SLOT(saveRule()));
  
  setCancelButton(tr("&Cancel"));  
  connect(this, SIGNAL(cancelButtonPressed()), this, SLOT(exitDialog()));
  
  setOkButton(QString::null);  
  
  setHelpButton();
  QObject::connect(this, SIGNAL(helpButtonPressed()), this, SLOT(slotHelp()));
  
  addTab(w, tr("Parms"));

  loadRule();
}
Exemple #23
0
TagsEditDialog::TagsEditDialog(QWidget *parent, State *stateToEdit, bool addNewTag)
        : KDialog(parent)
        ,  m_loading(false)
{
    // KDialog options
    setCaption(i18n("Customize Tags"));
    setButtons(Ok | Cancel);
    setDefaultButton(Ok);
    setObjectName("CustomizeTags");
    setModal(true);
    showButtonSeparator(true);
    connect(this, SIGNAL(okClicked()), SLOT(slotOk()));
    connect(this, SIGNAL(cancelClicked()), SLOT(slotCancel()));

    setMainWidget(new QWidget(this));

    QHBoxLayout *layout = new QHBoxLayout(mainWidget());

    /* Left part: */

    QPushButton *newTag     = new QPushButton(i18n("Ne&w Tag"),   mainWidget());
    QPushButton *newState   = new QPushButton(i18n("New St&ate"), mainWidget());

    connect(newTag,   SIGNAL(clicked()), this, SLOT(newTag()));
    connect(newState, SIGNAL(clicked()), this, SLOT(newState()));

    m_tags = new TagListView(mainWidget());
    m_tags->header()->hide();
    m_tags->setRootIsDecorated(false);
    //m_tags->addColumn("");
    //m_tags->setSorting(-1); // Sort column -1, so disabled sorting
    //m_tags->setResizeMode(QTreeWidget::LastColumn);

    m_moveUp    = new KPushButton(KGuiItem("", "arrow-up"),   mainWidget());
    m_moveDown  = new KPushButton(KGuiItem("", "arrow-down"), mainWidget());
    m_deleteTag = new KPushButton(KGuiItem("", "edit-delete"), mainWidget());

    m_moveUp->setToolTip(i18n("Move Up (Ctrl+Shift+Up)"));
    m_moveDown->setToolTip(i18n("Move Down (Ctrl+Shift+Down)"));
    m_deleteTag->setToolTip(i18n("Delete"));

    connect(m_moveUp,    SIGNAL(clicked()), this, SLOT(moveUp()));
    connect(m_moveDown,  SIGNAL(clicked()), this, SLOT(moveDown()));
    connect(m_deleteTag, SIGNAL(clicked()), this, SLOT(deleteTag()));

    QHBoxLayout *topLeftLayout = new QHBoxLayout;
    topLeftLayout->addWidget(m_moveUp);
    topLeftLayout->addWidget(m_moveDown);
    topLeftLayout->addWidget(m_deleteTag);

    QVBoxLayout *leftLayout = new QVBoxLayout;
    leftLayout->addWidget(newTag);
    leftLayout->addWidget(newState);
    leftLayout->addWidget(m_tags);
    leftLayout->addLayout(topLeftLayout);

    layout->addLayout(leftLayout);

    /* Right part: */

    QWidget *rightWidget = new QWidget(mainWidget());

    m_tagBox             = new QGroupBox(i18n("Tag"), rightWidget);
    m_tagBoxLayout       = new QHBoxLayout;
    m_tagBox->setLayout(m_tagBoxLayout);

    QWidget   *tagWidget = new QWidget;
    m_tagBoxLayout->addWidget(tagWidget);

    m_tagName = new QLineEdit(tagWidget);
    QLabel *tagNameLabel = new QLabel(i18n("&Name:"), tagWidget);
    tagNameLabel->setBuddy(m_tagName);

    m_shortcut = new KShortcutWidget(tagWidget);
    m_removeShortcut = new QPushButton(i18nc("Remove tag shortcut", "&Remove"), tagWidget);
    QLabel *shortcutLabel = new QLabel(i18n("S&hortcut:"), tagWidget);
    shortcutLabel->setBuddy(m_shortcut);
    //connect( m_shortcut,       SIGNAL(shortcutChanged(const KShortcut&)), this, SLOT(capturedShortcut(const KShortcut&)) );
    connect(m_removeShortcut, SIGNAL(clicked()),                          this, SLOT(removeShortcut()));

    m_inherit = new QCheckBox(i18n("&Inherited by new sibling notes"), tagWidget);

    QGridLayout *tagGrid = new QGridLayout(tagWidget);
    tagGrid->addWidget(tagNameLabel, 0, 0);
    tagGrid->addWidget(m_tagName, 0, 1, 1, 3);
    tagGrid->addWidget(shortcutLabel, 1, 0);
    tagGrid->addWidget(m_shortcut, 1, 1);
    tagGrid->addWidget(m_removeShortcut, 1, 2);
    tagGrid->addWidget(m_inherit, 2, 0, 1, 4);
    tagGrid->setColumnStretch(/*col=*/3, /*stretch=*/255);

    m_stateBox           = new QGroupBox(i18n("State"), rightWidget);
    m_stateBoxLayout = new QHBoxLayout;
    m_stateBox->setLayout(m_stateBoxLayout);

    QWidget *stateWidget = new QWidget;
    m_stateBoxLayout->addWidget(stateWidget);

    m_stateName = new QLineEdit(stateWidget);
    m_stateNameLabel = new QLabel(i18n("Na&me:"), stateWidget);
    m_stateNameLabel->setBuddy(m_stateName);

    QWidget *emblemWidget = new QWidget(stateWidget);
    m_emblem = new KIconButton(emblemWidget);
    m_emblem->setIconType(KIconLoader::NoGroup, KIconLoader::Action);
    m_emblem->setIconSize(16);
    m_emblem->setIcon("edit-delete");
    m_removeEmblem = new QPushButton(i18nc("Remove tag emblem", "Remo&ve"), emblemWidget);
    QLabel *emblemLabel = new QLabel(i18n("&Emblem:"), stateWidget);
    emblemLabel->setBuddy(m_emblem);
    connect(m_removeEmblem, SIGNAL(clicked()), this, SLOT(removeEmblem()));   // m_emblem.resetIcon() is not a slot!

    // Make the icon button and the remove button the same height:
    int height = qMax(m_emblem->sizeHint().width(), m_emblem->sizeHint().height());
    height = qMax(height, m_removeEmblem->sizeHint().height());
    m_emblem->setFixedSize(height, height); // Make it square
    m_removeEmblem->setFixedHeight(height);
    m_emblem->resetIcon();

    QHBoxLayout *emblemLayout = new QHBoxLayout(emblemWidget);
    emblemLayout->addWidget(m_emblem);
    emblemLayout->addWidget(m_removeEmblem);
    emblemLayout->addStretch();

    m_backgroundColor = new KColorCombo2(QColor(), palette().color(QPalette::Base), stateWidget);
    QLabel *backgroundColorLabel = new QLabel(i18n("&Background:"), stateWidget);
    backgroundColorLabel->setBuddy(m_backgroundColor);

    QHBoxLayout *backgroundColorLayout = new QHBoxLayout(0);
    backgroundColorLayout->addWidget(m_backgroundColor);
    backgroundColorLayout->addStretch();

    //QIcon boldIconSet = KIconLoader::global()->loadIconSet("format-text-bold", KIconLoader::Small);
    KIcon boldIconSet("format-text-bold", KIconLoader::global());
    m_bold = new QPushButton(boldIconSet, "", stateWidget);
    m_bold->setCheckable(true);
    int size = qMax(m_bold->sizeHint().width(), m_bold->sizeHint().height());
    m_bold->setFixedSize(size, size); // Make it square!
    m_bold->setToolTip(i18n("Bold"));

    //QIcon underlineIconSet = KIconLoader::global()->loadIconSet("format-text-underline", KIconLoader::Small);
    KIcon underlineIconSet("format-text-underline", KIconLoader::global());
    m_underline = new QPushButton(underlineIconSet, "", stateWidget);
    m_underline->setCheckable(true);
    m_underline->setFixedSize(size, size); // Make it square!
    m_underline->setToolTip(i18n("Underline"));

    //QIcon italicIconSet = KIconLoader::global()->loadIconSet("format-text-italic", KIconLoader::Small);
    KIcon italicIconSet("format-text-italic", KIconLoader::global());
    m_italic = new QPushButton(italicIconSet, "", stateWidget);
    m_italic->setCheckable(true);
    m_italic->setFixedSize(size, size); // Make it square!
    m_italic->setToolTip(i18n("Italic"));

    KIcon strikeIconSet("format-text-strikethrough", KIconLoader::global());
    m_strike = new QPushButton(strikeIconSet, "", stateWidget);
    m_strike->setCheckable(true);
    m_strike->setFixedSize(size, size); // Make it square!
    m_strike->setToolTip(i18n("Strike Through"));

    QLabel *textLabel = new QLabel(i18n("&Text:"), stateWidget);
    textLabel->setBuddy(m_bold);

    QHBoxLayout *textLayout = new QHBoxLayout;
    textLayout->addWidget(m_bold);
    textLayout->addWidget(m_underline);
    textLayout->addWidget(m_italic);
    textLayout->addWidget(m_strike);
    textLayout->addStretch();

    m_textColor = new KColorCombo2(QColor(), palette().color(QPalette::Text), stateWidget);
    QLabel *textColorLabel = new QLabel(i18n("Co&lor:"), stateWidget);
    textColorLabel->setBuddy(m_textColor);

    m_font = new QFontComboBox(stateWidget);
    m_font->addItem(i18n("(Default)"), 0);
    QLabel *fontLabel = new QLabel(i18n("&Font:"), stateWidget);
    fontLabel->setBuddy(m_font);

    m_fontSize = new FontSizeCombo(/*rw=*/true, /*withDefault=*/true, stateWidget);
    QLabel *fontSizeLabel = new QLabel(i18n("&Size:"), stateWidget);
    fontSizeLabel->setBuddy(m_fontSize);

    m_textEquivalent = new QLineEdit(stateWidget);
    QLabel *textEquivalentLabel = new QLabel(i18n("Te&xt equivalent:"), stateWidget);
    textEquivalentLabel->setBuddy(m_textEquivalent);
    QFont font = m_textEquivalent->font();
    font.setFamily("monospace");
    m_textEquivalent->setFont(font);

    HelpLabel *textEquivalentHelp = new HelpLabel(
        i18n("What is this for?"),
        "<p>" + i18n("When you copy and paste or drag and drop notes to a text editor, this text will be inserted as a textual equivalent of the tag.") + "</p>" +
//      "<p>" + i18n("If filled, this property lets you paste this tag or this state as textual equivalent.") + "<br>" +
        i18n("For instance, a list of notes with the <b>To Do</b> and <b>Done</b> tags are exported as lines preceded by <b>[ ]</b> or <b>[x]</b>, "
             "representing an empty checkbox and a checked box.") + "</p>" +
        "<p align='center'><img src=\":images/tag_export_help.png\"></p>",
        stateWidget);
    QHBoxLayout *textEquivalentHelpLayout = new QHBoxLayout;
    textEquivalentHelpLayout->addWidget(textEquivalentHelp);
    textEquivalentHelpLayout->addStretch(255);

    m_onEveryLines = new QCheckBox(i18n("On ever&y line"), stateWidget);

    HelpLabel *onEveryLinesHelp = new HelpLabel(
        i18n("What does this mean?"),
        "<p>" + i18n("When a note has several lines, you can choose to export the tag or the state on the first line or on every line of the note.") + "</p>" +
        "<p align='center'><img src=\":images/tag_export_on_every_lines_help.png\"></p>" +
        "<p>" + i18n("In the example above, the tag of the top note is only exported on the first line, while the tag of the bottom note is exported on every line of the note."),
        stateWidget);
    QHBoxLayout *onEveryLinesHelpLayout = new QHBoxLayout;
    onEveryLinesHelpLayout->addWidget(onEveryLinesHelp);
    onEveryLinesHelpLayout->addStretch(255);

    QGridLayout *textEquivalentGrid = new QGridLayout;
    textEquivalentGrid->addWidget(textEquivalentLabel,      0, 0);
    textEquivalentGrid->addWidget(m_textEquivalent,         0, 1);
    textEquivalentGrid->addLayout(textEquivalentHelpLayout, 0, 2);
    textEquivalentGrid->addWidget(m_onEveryLines,           1, 1);
    textEquivalentGrid->addLayout(onEveryLinesHelpLayout,   1, 2);
    textEquivalentGrid->setColumnStretch(/*col=*/3, /*stretch=*/255);

    KSeparator *separator = new KSeparator(Qt::Horizontal, stateWidget);

    QGridLayout *stateGrid = new QGridLayout(stateWidget);
    stateGrid->addWidget(m_stateNameLabel, 0, 0);
    stateGrid->addWidget(m_stateName, 0, 1, 1, 6);
    stateGrid->addWidget(emblemLabel, 1, 0);
    stateGrid->addWidget(emblemWidget, 1, 1, 1, 6);
    stateGrid->addWidget(backgroundColorLabel, 1, 5);
    stateGrid->addLayout(backgroundColorLayout, 1, 6, 1, 1);
    stateGrid->addWidget(textLabel, 2, 0);
    stateGrid->addLayout(textLayout, 2, 1, 1, 4);
    stateGrid->addWidget(textColorLabel, 2, 5);
    stateGrid->addWidget(m_textColor, 2, 6);
    stateGrid->addWidget(fontLabel, 3, 0);
    stateGrid->addWidget(m_font, 3, 1, 1, 4);
    stateGrid->addWidget(fontSizeLabel, 3, 5);
    stateGrid->addWidget(m_fontSize, 3, 6);
    stateGrid->addWidget(separator, 4, 0, 1, 7);
    stateGrid->addLayout(textEquivalentGrid, 5, 0, 1, 7);

    QVBoxLayout *rightLayout = new QVBoxLayout(rightWidget);
    rightLayout->addWidget(m_tagBox);
    rightLayout->addWidget(m_stateBox);
    rightLayout->addStretch();

    layout->addWidget(rightWidget);
    rightWidget->setSizePolicy(QSizePolicy::Maximum, QSizePolicy::Expanding);

    // Equalize the width of the first column of the two grids:
    int maxWidth = tagNameLabel->sizeHint().width();
    maxWidth = qMax(maxWidth, shortcutLabel->sizeHint().width());
    maxWidth = qMax(maxWidth, m_stateNameLabel->sizeHint().width());
    maxWidth = qMax(maxWidth, emblemLabel->sizeHint().width());
    maxWidth = qMax(maxWidth, textLabel->sizeHint().width());
    maxWidth = qMax(maxWidth, fontLabel->sizeHint().width());
    maxWidth = qMax(maxWidth, backgroundColorLabel->sizeHint().width());
    maxWidth = qMax(maxWidth, textEquivalentLabel->sizeHint().width());

    tagNameLabel->setFixedWidth(maxWidth);
    m_stateNameLabel->setFixedWidth(maxWidth);
    textEquivalentLabel->setFixedWidth(maxWidth);

    // Load Tags:
    for (Tag::List::iterator tagIt = Tag::all.begin(); tagIt != Tag::all.end(); ++tagIt)
        m_tagCopies.append(new TagCopy(*tagIt));

    TagListViewItem *lastInsertedItem = 0;
    TagListViewItem *lastInsertedSubItem;
    TagListViewItem *item;
    TagListViewItem *subItem;
    for (TagCopy::List::iterator tagCopyIt = m_tagCopies.begin(); tagCopyIt != m_tagCopies.end(); ++tagCopyIt) {
        // New List View Item:
        if (lastInsertedItem)
            item = new TagListViewItem(m_tags, lastInsertedItem, *tagCopyIt);
        else
            item = new TagListViewItem(m_tags, *tagCopyIt);
        item->setExpanded(true);
        lastInsertedItem = item;
        // Load
        if ((*tagCopyIt)->isMultiState()) {
            lastInsertedSubItem = 0;
            StateCopy::List stateCopies = item->tagCopy()->stateCopies;
            for (StateCopy::List::iterator stateCopyIt = stateCopies.begin(); stateCopyIt != stateCopies.end(); ++stateCopyIt) {
                if (lastInsertedSubItem)
                    subItem = new TagListViewItem(item, lastInsertedSubItem, *stateCopyIt);
                else
                    subItem = new TagListViewItem(item, *stateCopyIt);
                lastInsertedSubItem = subItem;
            }
        }
    }

    // Connect Signals:
    connect(m_tagName,         SIGNAL(textChanged(const QString&)),        this, SLOT(modified()));
    connect(m_shortcut,        SIGNAL(shortcutChanged(const KShortcut&)), this, SLOT(modified()));
    connect(m_inherit,         SIGNAL(stateChanged(int)),                  this, SLOT(modified()));
    connect(m_stateName,       SIGNAL(textChanged(const QString&)),        this, SLOT(modified()));
    connect(m_emblem,          SIGNAL(iconChanged(QString)),               this, SLOT(modified()));
    connect(m_backgroundColor, SIGNAL(activated(const QColor&)),             this, SLOT(modified()));
    connect(m_bold,            SIGNAL(toggled(bool)),                      this, SLOT(modified()));
    connect(m_underline,       SIGNAL(toggled(bool)),                      this, SLOT(modified()));
    connect(m_italic,          SIGNAL(toggled(bool)),                      this, SLOT(modified()));
    connect(m_strike,          SIGNAL(toggled(bool)),                      this, SLOT(modified()));
    connect(m_textColor,       SIGNAL(activated(const QColor&)),             this, SLOT(modified()));
    connect(m_font,            SIGNAL(textChanged(const QString&)),        this, SLOT(modified()));
    connect(m_fontSize,        SIGNAL(textChanged(const QString&)),        this, SLOT(modified()));
    connect(m_textEquivalent,  SIGNAL(textChanged(const QString&)),        this, SLOT(modified()));
    connect(m_onEveryLines,    SIGNAL(stateChanged(int)),                  this, SLOT(modified()));

    connect(m_tags,            SIGNAL(currentItemChanged(QTreeWidgetItem*, QTreeWidgetItem*)),     this,
            SLOT(currentItemChanged(QTreeWidgetItem*, QTreeWidgetItem*)));
    connect(m_tags,            SIGNAL(deletePressed()),                    this, SLOT(deleteTag()));
    connect(m_tags,            SIGNAL(doubleClickedItem()),                this, SLOT(renameIt()));

    QTreeWidgetItem *firstItem = m_tags->firstChild();
    if (stateToEdit != 0) {
        TagListViewItem *item = itemForState(stateToEdit);
        if (item)
            firstItem = item;
    }
    // Select the first tag unless the first tag is a multi-state tag.
    // In this case, select the first state, as it let customize the state AND the associated tag.
    if (firstItem) {
        if (firstItem->childCount() > 0)
            firstItem = firstItem->child(0);
        firstItem->setSelected(true);
        m_tags->setCurrentItem(firstItem);
        currentItemChanged(firstItem);
        if (stateToEdit == 0)
            m_tags->scrollToItem(firstItem);
        m_tags->setFocus();
    } else {
        m_moveUp->setEnabled(false);
        m_moveDown->setEnabled(false);
        m_deleteTag->setEnabled(false);
        m_tagBox->setEnabled(false);
        m_stateBox->setEnabled(false);
    }
    // TODO: Disabled both boxes if no tag!!!

    // Some keyboard shortcuts:       // Ctrl+arrows instead of Alt+arrows (same as Go menu in the main window) because Alt+Down is for combo boxes
    QAction *selectAbove = new QAction(this);
    selectAbove->setShortcut(Qt::CTRL + Qt::Key_Up);
    connect(selectAbove, SIGNAL(activated()), this, SLOT(selectUp()));

    QAction *selectBelow = new QAction(this);
    selectBelow->setShortcut(Qt::CTRL + Qt::Key_Down);
    connect(selectBelow, SIGNAL(activated()), this, SLOT(selectDown()));

    QAction *selectLeft = new QAction(this);
    selectLeft->setShortcut(Qt::CTRL + Qt::Key_Left);
    connect(selectLeft, SIGNAL(activated()), this, SLOT(selectLeft()));

    QAction *selectRight = new QAction(this);
    selectRight->setShortcut(Qt::CTRL + Qt::Key_Right);
    connect(selectRight, SIGNAL(activated()), this, SLOT(selectRight()));

    QAction *moveAbove = new QAction(this);
    moveAbove->setShortcut(Qt::CTRL + Qt::Key_Up);
    connect(moveAbove, SIGNAL(activated()), this, SLOT(moveUp()));

    QAction *moveBelow = new QAction(this);
    moveBelow->setShortcut(Qt::CTRL + Qt::SHIFT + Qt::Key_Down);
    connect(moveBelow, SIGNAL(activated()), this, SLOT(moveDown()));

    QAction *rename = new QAction(this);
    rename->setShortcut(Qt::Key_F2);
    connect(rename, SIGNAL(activated()), this, SLOT(renameIt()));

    m_tags->setMinimumSize(
        m_tags->sizeHint().width() * 2,
        m_tagBox->sizeHint().height() + m_stateBox->sizeHint().height()
    );

    if (addNewTag)
        QTimer::singleShot(0, this, SLOT(newTag()));
    else
        // Once the window initial size is computed and the window show, allow the user to resize it down:
        QTimer::singleShot(0, this, SLOT(resetTreeSizeHint()));
}
ExtendedAboutDialog::ExtendedAboutDialog(const KAboutData *aboutData, const OcsData *ocsData, QWidget *parent)
  : KDialog(parent)
  , d(new Private(this))
{
    DEBUG_BLOCK
    if (aboutData == 0)
        aboutData = KGlobal::mainComponent().aboutData();

    d->aboutData = aboutData;

    if (!aboutData) {
        QLabel *errorLabel = new QLabel(i18n("<qt>No information available.<br />"
                                             "The supplied KAboutData object does not exist.</qt>"), this);

        errorLabel->setTextInteractionFlags(Qt::TextBrowserInteraction);
        setMainWidget(errorLabel);
        return;
    }
    if( !ocsData )
    {
        QLabel *errorLabel = new QLabel(i18n("<qt>No information available.<br />"
                                             "The supplied OcsData object does not exist.</qt>"), this);

        errorLabel->setTextInteractionFlags(Qt::TextBrowserInteraction);
        setMainWidget(errorLabel);
        return;
    }
    m_ocsData = *ocsData;

    setPlainCaption(i18n("About %1", aboutData->programName()));
    setButtons(KDialog::Close);
    setDefaultButton(KDialog::Close);
    setModal(false);


    //Set up the title widget...
    KTitleWidget *titleWidget = new KTitleWidget(this);

    QIcon windowIcon;
    if (!aboutData->programIconName().isEmpty()) {
        windowIcon = KIcon(aboutData->programIconName());
    } else {
        windowIcon = qApp->windowIcon();
    }
    titleWidget->setPixmap(windowIcon.pixmap(64, 64), KTitleWidget::ImageLeft);
    if (aboutData->programLogo().canConvert<QPixmap>())
        titleWidget->setPixmap(aboutData->programLogo().value<QPixmap>(), KTitleWidget::ImageLeft);
    else if (aboutData->programLogo().canConvert<QImage>())
        titleWidget->setPixmap(QPixmap::fromImage(aboutData->programLogo().value<QImage>()), KTitleWidget::ImageLeft);

    titleWidget->setText(i18n("<html><font size=\"5\">%1</font><br /><b>Version %2</b><br />Using KDE %3</html>",
                         aboutData->programName(), aboutData->version(), KDE::versionString()));


    //Now let's add the tab bar...
    QTabWidget *tabWidget = new QTabWidget;
    tabWidget->setUsesScrollButtons(false);


    //Set up the first page...
    QString aboutPageText = aboutData->shortDescription() + '\n';

    if (!aboutData->otherText().isEmpty())
        aboutPageText += '\n' + aboutData->otherText() + '\n';

    if (!aboutData->copyrightStatement().isEmpty())
        aboutPageText += '\n' + aboutData->copyrightStatement() + '\n';

    if (!aboutData->homepage().isEmpty())
        aboutPageText += '\n' + QString("<a href=\"%1\">%1</a>").arg(aboutData->homepage()) + '\n';
    aboutPageText = aboutPageText.trimmed();

    QLabel *aboutLabel = new QLabel;
    aboutLabel->setWordWrap(true);
    aboutLabel->setOpenExternalLinks(true);
    aboutLabel->setText(aboutPageText.replace('\n', "<br />"));
    aboutLabel->setTextInteractionFlags(Qt::TextBrowserInteraction);

    QVBoxLayout *aboutLayout = new QVBoxLayout;
    aboutLayout->addStretch();
    aboutLayout->addWidget(aboutLabel);

    const int licenseCount = aboutData->licenses().count();
    debug()<< "About to show license stuff";
    debug()<< "License count is"<<licenseCount;
    for (int i = 0; i < licenseCount; ++i) {
        const KAboutLicense &license = aboutData->licenses().at(i);

        QLabel *showLicenseLabel = new QLabel;
        showLicenseLabel->setText(QString("<a href=\"%1\">%2</a>").arg(QString::number(i),
                                                                       i18n("License: %1",
                                                                            license.name(KAboutData::FullName))));
        showLicenseLabel->setTextInteractionFlags(Qt::TextBrowserInteraction);
        connect(showLicenseLabel, SIGNAL(linkActivated(QString)), this, SLOT(_k_showLicense(QString)));

        aboutLayout->addWidget(showLicenseLabel);
    }
    debug()<<"License widget added";

    aboutLayout->addStretch();

    QWidget *aboutWidget = new QWidget(this);
    aboutWidget->setLayout(aboutLayout);

    tabWidget->addTab(aboutWidget, i18n("&About"));


    //Stuff needed by both Authors and Credits pages:
    QPixmap openDesktopPixmap = QPixmap( KStandardDirs::locate( "data", "amarok/images/opendesktop-22.png" ) );
    QIcon openDesktopIcon = QIcon( openDesktopPixmap );


    //And now, the Authors page:
    const int authorCount = d->aboutData->authors().count();

    if (authorCount)
    {
        m_authorWidget = new QWidget( this );
        QVBoxLayout *authorLayout = new QVBoxLayout( m_authorWidget.data() );

        m_showOcsAuthorButton = new AnimatedBarWidget( openDesktopIcon,
                                     i18n( "Get data from openDesktop.org to learn more about the team" ),
                                     "process-working", m_authorWidget.data() );
        connect( m_showOcsAuthorButton.data(), SIGNAL(clicked()), this, SLOT(switchToOcsWidgets()) );
        authorLayout->addWidget( m_showOcsAuthorButton.data() );

        if (!aboutData->customAuthorTextEnabled() || !aboutData->customAuthorRichText().isEmpty())
        {
            QLabel *bugsLabel = new QLabel( m_authorWidget.data() );
            bugsLabel->setContentsMargins( 4, 2, 0, 4 );
            if (!aboutData->customAuthorTextEnabled())
            {
                if (aboutData->bugAddress().isEmpty() || aboutData->bugAddress() == "*****@*****.**")
                    bugsLabel->setText( i18n("Please use <a href=\"http://bugs.kde.org\">http://bugs.kde.org</a> to report bugs.\n") );
                else
                {
                    if(aboutData->authors().count() == 1 && (aboutData->authors().first().emailAddress() == aboutData->bugAddress()))
                    {
                        bugsLabel->setText( i18n("Please report bugs to <a href=\"mailto:%1\">%2</a>.\n",
                                              aboutData->authors().first().emailAddress(),
                                              aboutData->authors().first().emailAddress()));
                    }
                    else
                    {
                        bugsLabel->setText( i18n("Please report bugs to <a href=\"mailto:%1\">%2</a>.\n",
                                              aboutData->bugAddress(), aboutData->bugAddress()));
                    }
                }
            }
            else
                bugsLabel->setText( aboutData->customAuthorRichText() );
            authorLayout->addWidget( bugsLabel );
        }

        m_authorListWidget = new OcsPersonListWidget( d->aboutData->authors(), m_ocsData.authors(), OcsPersonItem::Author, m_authorWidget.data() );
        connect( m_authorListWidget.data(), SIGNAL(switchedToOcs()), m_showOcsAuthorButton.data(), SLOT(stop()) );
        connect( m_authorListWidget.data(), SIGNAL(switchedToOcs()), m_showOcsAuthorButton.data(), SLOT(fold()) );

        authorLayout->addWidget( m_authorListWidget.data() );
        authorLayout->setMargin( 0 );
        authorLayout->setSpacing( 2 );
        m_authorWidget.data()->setLayout( authorLayout );

        m_authorPageTitle = ( authorCount == 1 ) ? i18n("A&uthor") : i18n("A&uthors");
        tabWidget->addTab(m_authorWidget.data(), m_authorPageTitle);
        m_isOfflineAuthorWidget = true; //is this still used?
    }

    //Then the Credits page:
    const int creditCount = aboutData->credits().count();

    if (creditCount)
    {
        m_creditWidget = new QWidget( this );
        QVBoxLayout *creditLayout = new QVBoxLayout( m_creditWidget.data() );

        m_showOcsCreditButton = new AnimatedBarWidget( openDesktopIcon,
                                     i18n( "Get data from openDesktop.org to learn more about contributors" ),
                                     "process-working", m_creditWidget.data() );
        connect( m_showOcsCreditButton.data(), SIGNAL(clicked()), this, SLOT(switchToOcsWidgets()) );
        creditLayout->addWidget( m_showOcsCreditButton.data() );

        m_creditListWidget = new OcsPersonListWidget( d->aboutData->credits(), m_ocsData.credits(), OcsPersonItem::Contributor, m_creditWidget.data() );
        connect( m_creditListWidget.data(), SIGNAL(switchedToOcs()), m_showOcsCreditButton.data(), SLOT(stop()) );
        connect( m_creditListWidget.data(), SIGNAL(switchedToOcs()), m_showOcsCreditButton.data(), SLOT(fold()) );

        creditLayout->addWidget( m_creditListWidget.data() );
        creditLayout->setMargin( 0 );
        creditLayout->setSpacing( 2 );
        m_creditWidget.data()->setLayout( creditLayout );

        tabWidget->addTab( m_creditWidget.data(), i18n("&Contributors"));
        m_isOfflineCreditWidget = true; //is this still used?
    }

    //Finally, the Donors page:
    const int donorCount = ocsData->donors()->count();

    if (donorCount)
    {
        m_donorWidget = new QWidget( this );
        QVBoxLayout *donorLayout = new QVBoxLayout( m_donorWidget.data() );

        m_showOcsDonorButton = new AnimatedBarWidget( openDesktopIcon,
                                     i18n( "Get data from openDesktop.org to learn more about our generous donors" ),
                                     "process-working", m_donorWidget.data() );
        connect( m_showOcsDonorButton.data(), SIGNAL(clicked()), this, SLOT(switchToOcsWidgets()) );
        donorLayout->addWidget( m_showOcsDonorButton.data() );

        QList< KAboutPerson > donors;
        for( QList< QPair< QString, KAboutPerson > >::const_iterator it = m_ocsData.donors()->constBegin();
             it != m_ocsData.donors()->constEnd(); ++it )
        {
            donors << ( *it ).second;
        }
        m_donorListWidget = new OcsPersonListWidget( donors , m_ocsData.donors(), OcsPersonItem::Contributor, m_donorWidget.data() );
        connect( m_donorListWidget.data(), SIGNAL(switchedToOcs()), m_showOcsDonorButton.data(), SLOT(stop()) );
        connect( m_donorListWidget.data(), SIGNAL(switchedToOcs()), m_showOcsDonorButton.data(), SLOT(fold()) );

        donorLayout->addWidget( m_donorListWidget.data() );
        donorLayout->setMargin( 0 );
        donorLayout->setSpacing( 2 );
        QLabel *roktoberLabel =
            new QLabel(i18n("<p>Each year in October the Amarok team organizes a funding "
                            "drive called <b>Roktober</b>.</p>"
                            "<p>If you want your name mentioned on this list "
                            "<a href=\"http://amarok.kde.org/donations\"> donate "
                            "during Roktober</a> and opt-in.</p>"));
        roktoberLabel->setOpenExternalLinks(true);
        donorLayout->addWidget(roktoberLabel);
        m_donorWidget.data()->setLayout( donorLayout );

        tabWidget->addTab( m_donorWidget.data(), i18n("&Donors"));
        m_isOfflineDonorWidget = true;
    }


    //And the translators:
    QPalette transparentBackgroundPalette;
    transparentBackgroundPalette.setColor( QPalette::Base, Qt::transparent );
    transparentBackgroundPalette.setColor( QPalette::Text, transparentBackgroundPalette.color( QPalette::WindowText ) );


    const QList<KAboutPerson> translatorList = aboutData->translators();

    if(translatorList.count() > 0) {
        QString translatorPageText;

        QList<KAboutPerson>::ConstIterator it;
        for(it = translatorList.begin(); it != translatorList.end(); ++it) {
            translatorPageText += QString("<p style=\"margin: 0px;\">%1</p>").arg((*it).name());
            if (!(*it).emailAddress().isEmpty())
                translatorPageText += QString("<p style=\"margin: 0px; margin-left: 15px;\"><a href=\"mailto:%1\">%1</a></p>").arg((*it).emailAddress());
            translatorPageText += "<p style=\"margin: 0px;\">&nbsp;</p>";
        }

        translatorPageText += KAboutData::aboutTranslationTeam();

        KTextBrowser *translatorTextBrowser = new KTextBrowser;
        translatorTextBrowser->setFrameStyle(QFrame::NoFrame);
        translatorTextBrowser->setPalette(transparentBackgroundPalette);
        translatorTextBrowser->setHtml(translatorPageText);
        tabWidget->addTab(translatorTextBrowser, i18n("T&ranslation"));
    }

    //Jam everything together in a layout:
    QVBoxLayout *mainLayout = new QVBoxLayout;
    mainLayout->addWidget(titleWidget);
    mainLayout->addWidget(tabWidget);
    mainLayout->setMargin(0);

    QWidget *mainWidget = new QWidget;
    mainWidget->setLayout(mainLayout);
    setMainWidget(mainWidget);
    setInitialSize( QSize( 480, 460 ) );
}
CloseConfirmDialog::CloseConfirmDialog(
    QList<KTextEditor::Document*>& docs
  , KToggleAction* show_confirmation_action
  , QWidget* const parent
  )
  : KDialog(parent)
  , m_docs(docs)
{
    assert("Documents container expected to be non empty" && !docs.isEmpty());

    setCaption(i18n("Close files confirmation"));
    setButtons(Ok | Cancel);
    setModal(true);
    setDefaultButton(KDialog::Ok);

    KVBox* w = new KVBox(this);
    setMainWidget(w);
    w->setSpacing(KDialog::spacingHint());

    KHBox* lo1 = new KHBox(w);

    // dialog text
    QLabel* icon = new QLabel(lo1);
    icon->setPixmap(DesktopIcon("dialog-warning"));

    QLabel* t = new QLabel(
        i18n(
            "<qt>You are about to close the following documents..."
            "<p>It is last chance to uncheck those you don't want to close ;-)</p></qt>"
          )
      , lo1
      );
    lo1->setStretchFactor(t, 1000);

    // document list
    m_docs_tree = new QTreeWidget(w);
    QStringList headers;
    headers << i18n("Document") << i18n("Location");
    m_docs_tree->setHeaderLabels(headers);
    m_docs_tree->setSelectionMode(QAbstractItemView::SingleSelection);
    m_docs_tree->setRootIsDecorated(false);

    for (int i = 0; i < m_docs.size(); i++)
    {
        new KateDocItem(m_docs[i], m_docs_tree);
    }
    m_docs_tree->header()->setStretchLastSection(false);
    m_docs_tree->header()->setResizeMode(0, QHeaderView::ResizeToContents);
    m_docs_tree->header()->setResizeMode(1, QHeaderView::ResizeToContents);

    m_dont_ask_again = new QCheckBox(i18n("Do not ask again"), w);
    // NOTE If we are here, it means that 'Show Confirmation' action is enabled,
    // so not needed to read config...
    assert("Sanity check" && show_confirmation_action->isChecked());
    m_dont_ask_again->setCheckState(Qt::Checked);
    connect(m_dont_ask_again, SIGNAL(toggled(bool)), show_confirmation_action, SLOT(setChecked(bool)));

    // Update documents list according checkboxes
    connect(this, SIGNAL(accepted()), this, SLOT(updateDocsList()));

    KConfigGroup gcg(KGlobal::config(), "CloseConfirmationDialog");
    restoreDialogSize(gcg);                                 // restore dialog geometry from config
}
KoDocumentInfoDlg::KoDocumentInfoDlg(QWidget* parent, KoDocumentInfo* docInfo, KoDocumentRdf* docRdf)
        : KPageDialog(parent)
        , d(new KoDocumentInfoDlgPrivate)
{
    d->m_info = docInfo;
    d->m_rdf = docRdf;

    setCaption(i18n("Document Information"));
    setInitialSize(QSize(500, 500));
    setFaceType(KPageDialog::List);
    setButtons(KDialog::Ok | KDialog::Cancel);
    setDefaultButton(KDialog::Ok);

    d->m_aboutUi = new Ui::KoDocumentInfoAboutWidget();
    QWidget *infodlg = new QWidget();
    d->m_aboutUi->setupUi(infodlg);
    if (!KoEncryptionChecker::isEncryptionSupported()) {
        d->m_aboutUi->lblEncryptedDesc->setVisible(false);
        d->m_aboutUi->lblEncrypted->setVisible(false);
        d->m_aboutUi->pbEncrypt->setVisible(false);
        d->m_aboutUi->lblEncryptedPic->setVisible(false);
    }
    KPageWidgetItem *page = new KPageWidgetItem(infodlg, i18n("General"));
    page->setHeader(i18n("General"));

    // Ugly hack, the mimetype should be a parameter, instead
    KoDocument* doc = dynamic_cast< KoDocument* >(d->m_info->parent());
    if (doc) {
        KMimeType::Ptr mime = KMimeType::mimeType(doc->mimeType());
        if (! mime)
            mime = KMimeType::defaultMimeTypePtr();
        page->setIcon(KIcon(KIconLoader::global()->loadMimeTypeIcon(mime->iconName(), KIconLoader::Desktop, 48)));
    }
    addPage(page);
    d->m_pages.append(page);

    initAboutTab();

    d->m_authorUi = new Ui::KoDocumentInfoAuthorWidget();
    QWidget *authordlg = new QWidget();
    d->m_authorUi->setupUi(authordlg);
    page = new KPageWidgetItem(authordlg, i18n("Author"));
    page->setHeader(i18n("Author"));
    page->setIcon(KIcon("user-identity"));
    addPage(page);
    d->m_pages.append(page);

    initAuthorTab();

    // Saving encryption implies saving the document, this is done after closing the dialog
    connect(this, SIGNAL(hidden()), this, SLOT(slotSaveEncryption()));

    if (d->m_rdf) {
        d->m_rdfEditWidget = 0;

#ifdef SHOULD_BUILD_RDF
        d->m_rdfEditWidget = new KoDocumentRdfEditWidget(this, d->m_rdf);
        page = new KPageWidgetItem(d->m_rdfEditWidget->widget(), i18n("Rdf"));
        page->setHeader(i18n("Rdf"));
        page->setIcon(KIcon("text-rdf"));
        addPage(page);
        d->m_pages.append(page);
#endif
    }
}
FilterOptionsDialog::FilterOptionsDialog(QWidget *parent, int FilterType)
                   : KDialog(parent)
{
    setCaption(i18n("Filter Options"));
    setModal(true);
    showButtonSeparator(true);
    setButtons(Ok | Cancel);
    setDefaultButton(Ok);
    QWidget* box       = new QWidget(this);
    QFormLayout *layout = new QFormLayout(box);
    layout->setSpacing(spacingHint());
    layout->setMargin(0);
    setMainWidget(box);

    if (FilterType == 0)
    { // Add noise
        m_noiseType = new KComboBox(false, box);
        m_noiseType->addItem(i18nc("image noise type", "Uniform"));
        m_noiseType->addItem(i18nc("image noise type", "Gaussian"));
        m_noiseType->addItem(i18nc("image noise type", "Multiplicative"));
        m_noiseType->addItem(i18nc("image noise type", "Impulse"));
        m_noiseType->addItem(i18nc("image noise type", "Laplacian"));
        m_noiseType->addItem(i18nc("image noise type", "Poisson"));
        m_noiseType->setWhatsThis(i18n("Select here the algorithm method which will used "
                                       "to add random noise to the images."));
        layout->addRow(i18n("Noise algorithm:"), m_noiseType);
    }
    else if (FilterType == 2)
    { // Blur
        m_blurRadius = new KIntNumInput(3, box);
        initInput(m_blurRadius, 0, 20, i18n("px"));
        m_blurRadius->setWhatsThis(i18n("Select here the blur radius of the Gaussian, "
                                        "not counting the center pixel. For reasonable results, the "
                                        "radius should be larger than deviation. If you use a radius of 0 "
                                        "the blur operation selects a suitable radius."));
        layout->addRow(i18n("Radius:"), m_blurRadius);

        m_blurDeviation = new KIntNumInput(1, box);
        initInput(m_blurDeviation, 0, 20, i18n("px"));
        m_blurDeviation->setWhatsThis(i18n("Select here the standard deviation of the blur Gaussian."));
        layout->addRow(i18n("Deviation:"), m_blurDeviation);
    }
    else if (FilterType == 5)
    { // Median
        m_medianRadius = new KIntNumInput(3, box);
        initInput(m_medianRadius, 0, 20, i18n("px"));
        m_medianRadius->setWhatsThis(i18n("Select here the median radius of the pixel neighborhood. "
                                          "The algorithm applies a digital filter that improves the quality "
                                          "of noisy images. Each pixel is replaced by the median in a "
                                          "set of neighboring pixels as defined by the radius."));
        layout->addRow(i18n("Radius:"), m_medianRadius);
    }
    else if (FilterType == 6)
    { // Noise reduction
        m_noiseRadius = new KIntNumInput(3, box);
        initInput(m_noiseRadius, 0, 20, i18n("px"));
        m_noiseRadius->setWhatsThis(i18n("Select here the noise reduction radius value. "
                                         "The algorithm smooths the contours of an image while still "
                                         "preserving edge information. The algorithm works by replacing "
                                         "each pixel with its neighbor closest in value. A neighbor is "
                                         "defined by the radius. If you use a radius of 0 the algorithm "
                                         "selects a suitable radius."));
        layout->addRow(i18n("Radius:"), m_noiseRadius);
    }
    else if (FilterType == 7)
    { // Sharpen
        m_sharpenRadius = new KIntNumInput(3, box);
        initInput(m_sharpenRadius, 0, 20, i18n("px"));
        m_sharpenRadius->setWhatsThis(i18n("Select here the radius of the sharpen Gaussian, "
                                           "not counting the center pixel. For reasonable "
                                           "results, the radius should be larger than deviation. "
                                           "If you use a radius of 0 the sharpen operation selects a "
                                           "suitable radius."));
        layout->addRow(i18n("Radius:"), m_sharpenRadius);

        m_sharpenDeviation = new KIntNumInput(1, box);
        initInput(m_sharpenDeviation, 0, 20, i18n("px"));
        m_sharpenDeviation->setWhatsThis(i18n("Select here the sharpen deviation value of the "
                                              "Laplacian."));
        layout->addRow(i18n("Deviation:"), m_sharpenDeviation);
    }
    else if (FilterType == 8)
    { // Unsharp
        m_unsharpenRadius = new KIntNumInput(3, box);
        initInput(m_unsharpenRadius, 0, 20, i18n("px"));
        m_unsharpenRadius->setWhatsThis(i18n("Select here the radius of the unsharpen Gaussian, "
                                             "not counting the center pixel. The algorithm "
                                             "convolve the image with a Gaussian operator of the given "
                                             "radius and standard deviation. For reasonable results, "
                                             "radius should be larger than sigma. If you use a radius of 0 "
                                             "the algorithm selects a suitable radius."));
        layout->addRow(i18n("Radius:"), m_unsharpenRadius);

        m_unsharpenDeviation = new KIntNumInput(1, box);
        initInput(m_unsharpenDeviation, 0, 20, i18n("px"));
        m_unsharpenDeviation->setWhatsThis(i18n("Select here the unsharpen deviation value of the "
                                                "Gaussian."));
        layout->addRow(i18n("Deviation:"), m_unsharpenDeviation);

        m_unsharpenPercent = new KIntNumInput(100, box);
        initInput(m_unsharpenPercent, 1, 200, i18n("%"));
        m_unsharpenPercent->setWhatsThis(i18n("Select here the percentage difference between original "
                                              "and blurred image which should be added to original."));
        layout->addRow(i18n("Amount:"), m_unsharpenPercent);

        m_unsharpenThreshold = new KIntNumInput(5, box);
        initInput(m_unsharpenThreshold, 1, 100, i18n("%"));
        m_unsharpenThreshold->setWhatsThis(i18n("Select here the unsharpen threshold value, "
                                                "as a percentage of the maximum color component value, "
                                                "needed to apply the difference amount."));
        layout->addRow(i18n("Threshold:"), m_unsharpenThreshold);
    }
}
RecompressOptionsDialog::RecompressOptionsDialog(QWidget *parent)
                       : KDialog( parent)
{
    setCaption(i18n("Recompression Options"));
    setModal(true);
    setButtons(Ok | Cancel);
    setDefaultButton(Ok);
    QWidget* box = new QWidget( this );
    setMainWidget(box);
    Q3VBoxLayout *dvlay = new Q3VBoxLayout( box, 10, spacingHint() );
    QString whatsThis;

    // JPEG file format.

    Q3GroupBox * groupBox1 = new Q3GroupBox( 2, Qt::Horizontal, i18n("JPEG File Format"), box );

    m_label_JPEGimageCompression = new QLabel (i18n("Image compression level:"), groupBox1);
    m_JPEGCompression = new KIntNumInput(75, groupBox1);
    m_JPEGCompression->setRange(1, 100);
    m_JPEGCompression->setSliderEnabled(true);
    whatsThis = i18n("<p>The compression value for JPEG target images:<p>");
    whatsThis = whatsThis + i18n("<b>1</b>: very high compression<p>"
                                 "<b>25</b>: high compression<p>"
                                 "<b>50</b>: medium compression<p>"
                                 "<b>75</b>: low compression (default value)<p>"
                                 "<b>100</b>: no compression");

    m_JPEGCompression->setWhatsThis(whatsThis);
    m_label_JPEGimageCompression->setBuddy( m_JPEGCompression );

    m_compressLossLess = new QCheckBox( i18n("Use lossless compression"), groupBox1);
    m_compressLossLess->setWhatsThis(i18n("<p>If this option is enabled, "
                                              "all JPEG operations will use lossless compression."));

    connect(m_compressLossLess, SIGNAL( toggled(bool) ),
            this, SLOT( slotCompressLossLessEnabled(bool) ) );

    dvlay->addWidget( groupBox1 );

    // PNG File format.

    Q3GroupBox * groupBox2 = new Q3GroupBox( 2, Qt::Horizontal, i18n("PNG File Format"), box );

    m_label_PNGimageCompression = new QLabel (i18n("Image compression level:"), groupBox2);
    m_PNGCompression = new KIntNumInput(75, groupBox2);
    m_PNGCompression->setRange(1, 100);
    m_PNGCompression->setSliderEnabled(true);
    whatsThis = i18n("<p>The compression value for PNG target images:<p>");
    whatsThis = whatsThis + i18n("<b>1</b>: very high compression<p>"
                                 "<b>25</b>: high compression<p>"
                                 "<b>50</b>: medium compression<p>"
                                 "<b>75</b>: low compression (default value)<p>"
                                 "<b>100</b>: no compression");

    m_PNGCompression->setWhatsThis(whatsThis);
    m_label_PNGimageCompression->setBuddy( m_PNGCompression );

    dvlay->addWidget( groupBox2 );

    // TIFF File format.

    Q3GroupBox * groupBox3 = new Q3GroupBox( 2, Qt::Horizontal, i18n("TIFF File Format"), box );

    m_label_TIFFimageCompression = new QLabel (i18n("Image compression algorithm:"), groupBox3);
    m_TIFFCompressionAlgo = new QComboBox( false, groupBox3 );
    m_TIFFCompressionAlgo->insertItem("LZW");
    m_TIFFCompressionAlgo->insertItem("JPEG");
    m_TIFFCompressionAlgo->insertItem(i18n("None"));
    m_TIFFCompressionAlgo->setWhatsThis(i18n("<p>Select here the TIFF compression algorithm.") );
    m_label_TIFFimageCompression->setBuddy( m_TIFFCompressionAlgo );

    dvlay->addWidget( groupBox3 );

    // TGA File format.

    Q3GroupBox * groupBox4 = new Q3GroupBox( 2, Qt::Horizontal, i18n("TGA File Format"), box );

    m_label_TGAimageCompression = new QLabel (i18n("Image compression algorithm:"), groupBox4);
    m_TGACompressionAlgo = new QComboBox( false, groupBox4 );
    m_TGACompressionAlgo->insertItem("RLE");
    m_TGACompressionAlgo->insertItem(i18n("None"));
    m_TGACompressionAlgo->setWhatsThis(i18n("<p>Select here the TGA compression algorithm.") );
    m_label_TGAimageCompression->setBuddy( m_TGACompressionAlgo );

    dvlay->addWidget( groupBox4 );
}
Exemple #29
0
BackupDialog::BackupDialog(QWidget *parent, const char *name)
        : KDialog(parent)
{
    setObjectName(name);
    setModal(true);
    setCaption(i18n("Backup & Restore"));
    setButtons(KDialog::Close);
    setDefaultButton(KDialog::Close);
    showButtonSeparator(false);

    KVBox *page  = new KVBox(this);
    setMainWidget(page);

//  page->setSpacing(spacingHint());

    QString savesFolder = Global::savesFolder();
    savesFolder = savesFolder.left(savesFolder.length() - 1); // savesFolder ends with "/"

    QGroupBox *folderGroup = new QGroupBox(i18n("Save Folder"), page);
    QVBoxLayout* folderGroupLayout = new QVBoxLayout;
    folderGroup->setLayout(folderGroupLayout);
    folderGroupLayout->addWidget(new QLabel("<qt><nobr>" + i18n("Your baskets are currently stored in that folder:<br><b>%1</b>", savesFolder), folderGroup));
    QWidget *folderWidget = new QWidget;
    folderGroupLayout->addWidget(folderWidget);

    QHBoxLayout *folderLayout = new QHBoxLayout(folderWidget);
    folderLayout->setContentsMargins(0, 0, 0, 0);

    QPushButton *moveFolder = new QPushButton(i18n("&Move to Another Folder..."),      folderWidget);
    QPushButton *useFolder  = new QPushButton(i18n("&Use Another Existing Folder..."), folderWidget);
    HelpLabel *helpLabel = new HelpLabel(i18n("Why to do that?"), i18n(
                                             "<p>You can move the folder where %1 store your baskets to:</p><ul>"
                                             "<li>Store your baskets in a visible place in your home folder, like ~/Notes or ~/Baskets, so you can manually backup them when you want.</li>"
                                             "<li>Store your baskets on a server to share them between two computers.<br>"
                                             "In this case, mount the shared-folder to the local file system and ask %1 to use that mount point.<br>"
                                             "Warning: you should not run %1 at the same time on both computers, or you risk to loss data while the two applications are desynced.</li>"
                                             "</ul><p>Please remember that you should not change the content of that folder manually (eg. adding a file in a basket folder will not add that file to the basket).</p>",
                                             KGlobal::mainComponent().aboutData()->programName()),
                                         folderWidget);
    folderLayout->addWidget(moveFolder);
    folderLayout->addWidget(useFolder);
    folderLayout->addWidget(helpLabel);
    folderLayout->addStretch();
    connect(moveFolder, SIGNAL(clicked()), this, SLOT(moveToAnotherFolder()));
    connect(useFolder,  SIGNAL(clicked()), this, SLOT(useAnotherExistingFolder()));

    QGroupBox *backupGroup = new QGroupBox(i18n("Backups"), page);
    QVBoxLayout* backupGroupLayout = new QVBoxLayout;
    backupGroup->setLayout(backupGroupLayout);
    QWidget *backupWidget = new QWidget;
    backupGroupLayout->addWidget(backupWidget);

    QHBoxLayout *backupLayout = new QHBoxLayout(backupWidget);
    backupLayout->setContentsMargins(0, 0, 0, 0);

    QPushButton *backupButton  = new QPushButton(i18n("&Backup..."),           backupWidget);
    QPushButton *restoreButton = new QPushButton(i18n("&Restore a Backup..."), backupWidget);
    m_lastBackup = new QLabel("", backupWidget);
    backupLayout->addWidget(backupButton);
    backupLayout->addWidget(restoreButton);
    backupLayout->addWidget(m_lastBackup);
    backupLayout->addStretch();
    connect(backupButton,  SIGNAL(clicked()), this, SLOT(backup()));
    connect(restoreButton, SIGNAL(clicked()), this, SLOT(restore()));

    populateLastBackup();

    (new QWidget(page))->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding);
}
Exemple #30
0
void KNoteBook::setDefaultButton()
{
  setDefaultButton(klocale->translate("&Default"));
}