Example #1
0
QString FormAssistant::currentPage() const
{
    KPageWidgetItem* item = KPageDialog::currentPage();
    return item ? item->name() : QString();
}
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
    }
}
Example #3
0
KonviSettingsDialog::KonviSettingsDialog( QWidget *parent) :
    ConfigDialog( parent, QLatin1String("settings"), Preferences::self())
{
  setFaceType(KPageDialog::Tree);

  m_modified = false;

  KPageWidgetItem* interfaceGroup = new KPageWidgetItem(new QWidget(this), i18n("Interface"));
  interfaceGroup->setIcon(QIcon::fromTheme("preferences-desktop-theme"));
  KPageDialog::addPage(interfaceGroup);

  KPageWidgetItem* behaviorGroup = new KPageWidgetItem(new QWidget(this), i18n("Behavior"));
  behaviorGroup->setIcon(QIcon::fromTheme("configure"));
  KPageDialog::addPage(behaviorGroup);

  KPageWidgetItem* notificationGroup = new KPageWidgetItem(new QWidget(this), i18n("Notifications"));
  notificationGroup->setIcon(QIcon::fromTheme("preferences-desktop-notification"));
  KPageDialog::addPage(notificationGroup);

  QWidget *w = 0;

  //Interface/Chat Window
  Ui::ChatWindowAppearance_Config confChatWindowAppearance;
  w = new QWidget();
  confChatWindowAppearance.setupUi(w);
  confChatWindowAppearance.kcfg_TimestampFormat->addItem("hh:mm");
  confChatWindowAppearance.kcfg_TimestampFormat->addItem("hh:mm:ss");
  confChatWindowAppearance.kcfg_TimestampFormat->addItem("h:m ap");
  konviAddSubPage(interfaceGroup, w, i18n("Chat Window"), QLatin1String("view-list-text"));

  //Interface/Themes
  m_confThemeWdg = new Theme_Config( this, "Theme" );
  konviAddSubPage(interfaceGroup, m_confThemeWdg, i18n("Nicklist Themes"), QLatin1String("preferences-desktop-icons"));
  m_pages.append(m_confThemeWdg);
  connect(m_confThemeWdg, &Theme_Config::modified, this, &KonviSettingsDialog::modifiedSlot);

  //Interface/Colors
  Ui::ColorsAppearance_Config confColorsAppearance;
  w = new QWidget();
  confColorsAppearance.setupUi(w);
  konviAddSubPage(interfaceGroup, w, i18n("Colors"), QLatin1String("preferences-desktop-color"));

  //Interface/Fonts
  Ui::FontAppearance_Config confFontAppearance;
  w = new QWidget();
  confFontAppearance.setupUi(w);
  konviAddSubPage(interfaceGroup, w, i18n("Fonts"), QLatin1String("preferences-desktop-font"));

  //Interface/Quick Buttons
  m_confQuickButtonsWdg = new QuickButtons_Config( this, "QuickButtons" );
  konviAddSubPage(interfaceGroup, m_confQuickButtonsWdg, i18n("Quick Buttons"), QLatin1String("preferences-desktop-keyboard"));
  m_pages.append(m_confQuickButtonsWdg);
  connect(m_confQuickButtonsWdg, &QuickButtons_Config::modified, this, &KonviSettingsDialog::modifiedSlot);

  //Interface/Tabs
  m_confTabBarWdg = new Tabs_Config( this, "TabBar" );
  konviAddSubPage(interfaceGroup, m_confTabBarWdg, i18n("Tabs"), QLatin1String("tab-new"));

  //Behavior/General
  Ui::GeneralBehavior_ConfigUI confGeneralBehavior;
  w = new QWidget();
  confGeneralBehavior.setupUi(w);
  konviAddSubPage(behaviorGroup, w, i18n("General Behavior"), QLatin1String("configure"));

  //Behavior/Connection
  ConnectionBehavior_Config* confConnectionBehavior = new ConnectionBehavior_Config(this);
  confConnectionBehavior->setObjectName("ConnectionBehavior");
  konviAddSubPage(behaviorGroup, confConnectionBehavior, i18n("Connection"), QLatin1String("network-connect"));
  m_pages.append(confConnectionBehavior);

  //Behaviour/Chat Window
  Ui::ChatwindowBehaviour_Config confChatwindowBehaviour;
  w = new QWidget();
  confChatwindowBehaviour.setupUi(w);
  confChatwindowBehaviour.kcfg_ScrollbackMax->setSuffix(ki18np(" line", " lines"));
  confChatwindowBehaviour.kcfg_AutoWhoNicksLimit->setSuffix(ki18np(" nick", " nicks"));
  confChatwindowBehaviour.kcfg_AutoWhoContinuousInterval->setSuffix(ki18np(" second", " seconds"));
  konviAddSubPage(behaviorGroup, w, i18n("Chat Window"), QLatin1String("view-list-text"));

  //Behaviour/Nickname List
  m_confNicklistBehaviorWdg = new NicklistBehavior_Config( this, "NicklistBehavior" );
  konviAddSubPage(behaviorGroup, m_confNicklistBehaviorWdg, i18n("Nickname List"), QLatin1String("preferences-contact-list"));
  connect(m_confNicklistBehaviorWdg, &NicklistBehavior_Config::modified, this, &KonviSettingsDialog::modifiedSlot);
  m_pages.append(m_confNicklistBehaviorWdg);

  //Behaviour/Command Aliases
  m_confAliasWdg = new Alias_Config( this, "Alias" );
  konviAddSubPage(behaviorGroup, m_confAliasWdg, i18n("Command Aliases"), QLatin1String("edit-rename"));
  m_pages.append(m_confAliasWdg);
  connect(m_confAliasWdg, &Alias_Config::modified, this, &KonviSettingsDialog::modifiedSlot);

  //Behaviour/Auto Replace
  m_confAutoreplaceWdg = new Autoreplace_Config( this, "Autoreplace" );
  konviAddSubPage(behaviorGroup, m_confAutoreplaceWdg, i18n("Auto Replace"), QLatin1String("edit-rename"));
  m_pages.append(m_confAutoreplaceWdg);
  connect(m_confAutoreplaceWdg, &Autoreplace_Config::modified, this, &KonviSettingsDialog::modifiedSlot);

  //Behaviour/Ignore
  m_confIgnoreWdg = new Ignore_Config(this, "Ignore");
  konviAddSubPage(behaviorGroup, m_confIgnoreWdg, i18nc("@title:tab", "Ignore"), QLatin1String("process-stop"));
  connect(m_confIgnoreWdg, &Ignore_Config::modified, this, &KonviSettingsDialog::modifiedSlot);
  m_pages.append(m_confIgnoreWdg);

  //Behaviour/Logging
  Ui::Log_Config confLog;
  w = new QWidget();
  confLog.setupUi(w);
  confLog.kcfg_LogfilePath->setMode(KFile::Directory | KFile::ExistingOnly | KFile::LocalOnly);
  konviAddSubPage(behaviorGroup, w, i18n("Logging"), QLatin1String("text-plain"));

  //DCC
  m_confDCCWdg = new DCC_Config(this, "DCC");
  konviAddSubPage(behaviorGroup, m_confDCCWdg, i18nc("@title:tab", "DCC"), QLatin1String("arrow-right-double"));

  //Notifications/Tab Bar
  Ui::TabNotifications_Config confTabNotifications;
  w = new QWidget();
  confTabNotifications.setupUi(w);
  konviAddSubPage(notificationGroup, w, i18n("Tabs"), QLatin1String("tab-new"));

  //Notification/Highlighting
  m_confHighlightWdg = new Highlight_Config( this, "Highlight" );
  konviAddSubPage(notificationGroup, m_confHighlightWdg, i18n("Highlight"), QLatin1String("flag-red"));
  connect(m_confHighlightWdg, &Highlight_Config::modified, this, &KonviSettingsDialog::modifiedSlot);
  m_pages.append(m_confHighlightWdg);

  //Notification/Watched Nicknames
  Ui::WatchedNicknames_ConfigUI confWatchedNicks;
  w = new QWidget();
  confWatchedNicks.setupUi(w);
  konviAddSubPage(notificationGroup, w, i18n("Watched Nicknames"), QLatin1String("edit-find-user"));

  //Notification/On Screen Display
  m_confOSDWdg = new OSD_Config( this, "OSD" );
  konviAddSubPage(notificationGroup, m_confOSDWdg, i18n("On Screen Display"), QLatin1String("video-display"));
  //no modified connection needed - it's all kcfg widgets
  m_pages.append(m_confOSDWdg);

  //Notification/Warning Dialogs
  m_confWarningsWdg = new Warnings_Config( this, "Warnings" );
  konviAddSubPage(notificationGroup, m_confWarningsWdg, i18n("Warning Dialogs"), QLatin1String("dialog-warning"));
  m_pages.append(m_confWarningsWdg);
  connect(m_confWarningsWdg, &Warnings_Config::modified, this, &KonviSettingsDialog::modifiedSlot);
}
Example #4
0
KPageWidgetTest::KPageWidgetTest( QWidget *parent )
  : QWidget( parent )
{
  QGridLayout *layout = new QGridLayout( this );

  mWidget = new KPageWidget( this );
  layout->addWidget( mWidget, 0, 0, 7, 1 );

  connect( mWidget, SIGNAL( currentPageChanged( KPageWidgetItem*, KPageWidgetItem* ) ),
           this, SLOT( currentPageChanged( KPageWidgetItem*, KPageWidgetItem* ) ) );
  connect( mWidget, SIGNAL( pageToggled( KPageWidgetItem*, bool ) ),
           this, SLOT( pageToggled( KPageWidgetItem*, bool ) ) );

  int rowCount = 0;
  QPushButton *button = new QPushButton( "Auto", this );
  layout->addWidget( button, rowCount, 1 );
  connect( button, SIGNAL( clicked() ), this, SLOT( setAutoFace() ) );
  rowCount++;

  button = new QPushButton( "Plain", this );
  layout->addWidget( button, rowCount, 1 );
  connect( button, SIGNAL( clicked() ), this, SLOT( setPlainFace() ) );
  rowCount++;

  button = new QPushButton( "List", this );
  layout->addWidget( button, rowCount, 1 );
  connect( button, SIGNAL( clicked() ), this, SLOT( setListFace() ) );
  rowCount++;

  button = new QPushButton( "Tree", this );
  layout->addWidget( button, rowCount, 1 );
  connect( button, SIGNAL( clicked() ), this, SLOT( setTreeFace() ) );
  rowCount++;

  button = new QPushButton( "Tabbed", this );
  layout->addWidget( button, rowCount, 1 );
  connect( button, SIGNAL( clicked() ), this, SLOT( setTabbedFace() ) );
  rowCount++;

  button = new QPushButton( "Add Page", this );
  layout->addWidget( button, rowCount, 1 );
  connect( button, SIGNAL( clicked() ), this, SLOT( addPage() ) );
  rowCount++;

  button = new QPushButton( "Add Sub Page", this );
  layout->addWidget( button, rowCount, 1 );
  connect( button, SIGNAL( clicked() ), this, SLOT( addSubPage() ) );
  rowCount++;

  button = new QPushButton( "Insert Page", this );
  layout->addWidget( button, rowCount, 1 );
  connect( button, SIGNAL( clicked() ), this, SLOT( insertPage() ) );
  rowCount++;

  button = new QPushButton( "Delete Page", this );
  layout->addWidget( button, rowCount, 1 );
  connect( button, SIGNAL( clicked() ), this, SLOT( deletePage() ) );
  rowCount++;

  KPageWidgetItem *item = mWidget->addPage( new QPushButton( "folder" ), "folder" );
  item->setIcon( KIcon( "folder" ) );
  item = mWidget->addSubPage( item, new QPushButton( "subfolder" ), "subfolder" );
  item->setIcon( KIcon( "folder" ) );
  item = mWidget->addPage( new QLabel( "second folder" ), "second folder" );
  item->setIcon( KIcon( "folder" ) );
}
ConfigurationDialog::ConfigurationDialog(QWidget *parent) : KPageDialog(parent)
{
	setCaption(i18nc("@title:window", "Configure Kaffeine"));

	QWidget *widget = new QWidget(this);
	QGridLayout *gridLayout = new QGridLayout(widget);

	startupDisplayModeBox = new KComboBox(widget);
	startupDisplayModeBox->addItem(i18nc("@item:inlistbox 'Startup display mode:'",
		"Normal Mode"));
	startupDisplayModeBox->addItem(i18nc("@item:inlistbox 'Startup display mode:'",
		"Minimal Mode"));
	startupDisplayModeBox->addItem(i18nc("@item:inlistbox 'Startup display mode:'",
		"Full Screen Mode"));
	startupDisplayModeBox->addItem(i18nc("@item:inlistbox 'Startup display mode:'",
		"Remember Last Setting"));
	startupDisplayModeBox->setCurrentIndex(Configuration::instance()->getStartupDisplayMode());
	gridLayout->addWidget(startupDisplayModeBox, 0, 1);

	QLabel *label = new QLabel(i18nc("@label:listbox", "Startup display mode:"), widget);
	label->setBuddy(startupDisplayModeBox);
	gridLayout->addWidget(label, 0, 0);

	shortSkipBox = new QSpinBox(widget);
	shortSkipBox->setRange(1, 600);
	shortSkipBox->setValue(Configuration::instance()->getShortSkipDuration());
	gridLayout->addWidget(shortSkipBox, 1, 1);

	label = new QLabel(i18nc("@label:spinbox", "Short skip duration:"), widget);
	label->setBuddy(shortSkipBox);
	gridLayout->addWidget(label, 1, 0);

	longSkipBox = new QSpinBox(widget);
	longSkipBox->setRange(1, 600);
	longSkipBox->setValue(Configuration::instance()->getLongSkipDuration());
	gridLayout->addWidget(longSkipBox, 2, 1);

	label = new QLabel(i18nc("@label:spinbox", "Long skip duration:"), widget);
	label->setBuddy(longSkipBox);
	gridLayout->addWidget(label, 2, 0);
	gridLayout->setRowStretch(3, 1);

	KPageWidgetItem *page = new KPageWidgetItem(widget, i18nc("@title:group", "General"));
	page->setIcon(KIcon(QLatin1String("configure")));
	addPage(page);

	widget = new QWidget(this);
	gridLayout = new QGridLayout(widget);

	label = new QLabel(i18nc("@label:textbox", "Log messages:"), widget);
	gridLayout->addWidget(label, 0, 0);

	QPushButton *pushButton = new QPushButton(i18nc("@action:button", "Show dmesg"));
	pushButton->setSizePolicy(QSizePolicy::Fixed, QSizePolicy::Fixed);
	connect(pushButton, SIGNAL(clicked()), this, SLOT(showDmesg()));
	gridLayout->addWidget(pushButton, 0, 1);

	QPlainTextEdit *textEdit = new QPlainTextEdit(widget);
	textEdit->setPlainText(Log::getLog());
	textEdit->setReadOnly(true);
	gridLayout->addWidget(textEdit, 1, 0, 1, 2);
	gridLayout->setRowStretch(2, 1);

	page = new KPageWidgetItem(widget, i18nc("@title:group", "Diagnostics"));
	page->setIcon(KIcon(QLatin1String("page-zoom")));
	addPage(page);
}
Example #6
0
ConfigureDialog::ConfigureDialog(const QString &destName, bool isClass, QWidget *parent) :
    KPageDialog(parent)
{
    setFaceType(List);
    setModal(false);
    setStandardButtons(QDialogButtonBox::Ok | QDialogButtonBox::Cancel | QDialogButtonBox::Apply);
    setWindowTitle(destName);
    setWindowIcon(QIcon::fromTheme("configure"));
    enableButtonApply(false);
    // Needed so we have our dialog size saved
    setAttribute(Qt::WA_DeleteOnClose);

    QStringList attr;
    KPageWidgetItem *page;

    modifyPrinter = new ModifyPrinter(destName, isClass, this);
    PrinterBehavior *printerBehavior = new PrinterBehavior(destName, isClass, this);
    attr << modifyPrinter->neededValues();
    attr << printerBehavior->neededValues();
    attr << KCUPS_PRINTER_TYPE; // needed to know if it's a remote printer
    attr << KCUPS_PRINTER_MAKE_AND_MODEL;

    KCupsPrinter printer;
    QPointer<KCupsRequest> request = new KCupsRequest;
    request->getPrinterAttributes(destName, isClass, attr);
    request->waitTillFinished();
    if (!request) {
        return;
    }
    if (!request->hasError() && !request->printers().isEmpty()){
        printer = request->printers().first();
    }
//    qCDebug(PM_CONFIGURE_PRINTER) << "VALUES" << printer.a rgument();
//    qCDebug(PM_CONFIGURE_PRINTER) << "marker" << values["marker-levels"].value<QList<int> >();

    request->deleteLater();

    //     qCDebug(PM_CONFIGURE_PRINTER) << values;
    if (printer.type() & CUPS_PRINTER_LOCAL) {
        qCDebug(PM_CONFIGURE_PRINTER) << "CUPS_PRINTER_LOCAL";
    }
    isClass = printer.isClass();
    bool isRemote = false;
    if (printer.type() & CUPS_PRINTER_REMOTE) {
        qCDebug(PM_CONFIGURE_PRINTER) << "CUPS_PRINTER_REMOTE";
        isRemote = true;
    }
    if (printer.type() & CUPS_PRINTER_BW) {
        qCDebug(PM_CONFIGURE_PRINTER) << "CUPS_PRINTER_BW";
    }
    if (printer.type() & CUPS_PRINTER_COLOR) {
        qCDebug(PM_CONFIGURE_PRINTER) << "CUPS_PRINTER_COLOR";
    }
    if (printer.type() & CUPS_PRINTER_MFP) {
        qCDebug(PM_CONFIGURE_PRINTER) << "CUPS_PRINTER_MFP";
    }

    modifyPrinter->setRemote(isRemote);
    modifyPrinter->setValues(printer);
    page = new KPageWidgetItem(modifyPrinter, i18n("Modify Printer"));
    page->setHeader(i18n("Configure"));
    page->setIcon(QIcon::fromTheme("dialog-information"));
    // CONNECT this signal ONLY to the first Page
    connect(modifyPrinter, SIGNAL(changed(bool)), this, SLOT(enableButtonApply(bool)));
    addPage(page);

    if (!isClass) {
        // At least on localhost:631 modify printer does not show printer options
        // for classes
        printerOptions = new PrinterOptions(destName, isClass, isRemote, this);
        page = new KPageWidgetItem(printerOptions, i18n("Printer Options"));
        page->setHeader(i18n("Set the Default Printer Options"));
        page->setIcon(QIcon::fromTheme("view-pim-tasks"));
        addPage(page);
        connect(modifyPrinter, SIGNAL(ppdChanged()), this, SLOT(ppdChanged()));
        modifyPrinter->setCurrentMake(printerOptions->currentMake());
        modifyPrinter->setCurrentMakeAndModel(printerOptions->currentMakeAndModel());
    }

    printerBehavior->setRemote(isRemote);
    printerBehavior->setValues(printer);
    page = new KPageWidgetItem(printerBehavior, i18n("Banners, Policies and Allowed Users"));
    page->setHeader(i18n("Banners, Policies and Allowed Users"));
    page->setIcon(QIcon::fromTheme("feed-subscribe"));
    addPage(page);

    // connect this after ALL pages were added, otherwise the slot will be called
    connect(this, SIGNAL(currentPageChanged(KPageWidgetItem*,KPageWidgetItem*)),
            SLOT(currentPageChanged(KPageWidgetItem*,KPageWidgetItem*)));

    KConfigGroup group(KSharedConfig::openConfig("print-manager"), "ConfigureDialog");
    KWindowConfig::restoreWindowSize(windowHandle(), group);

    connect(buttonBox(), SIGNAL(clicked(QAbstractButton*)), this, SLOT(slotButtonClicked(QAbstractButton*)));
}
Example #7
0
PropertiesDialog::PropertiesDialog(QWidget *parent, Okular::Document *doc)
    : KPageDialog( parent ), m_document( doc ), m_fontPage( 0 ),
      m_fontModel( 0 ), m_fontInfo( 0 ), m_fontProgressBar( 0 ),
      m_fontScanStarted( false )
{
    setFaceType( Tabbed );
    setCaption( i18n( "Unknown File" ) );
    setButtons( Ok );

    // PROPERTIES
    QFrame *page = new QFrame();
    KPageWidgetItem *item = addPage( page, i18n( "&Properties" ) );
    item->setIcon( KIcon( "document-properties" ) );

    // get document info
    const Okular::DocumentInfo info = doc->documentInfo();
    QFormLayout *layout = new QFormLayout( page );

    // mime name based on mimetype id
    QString mimeName = info.get( Okular::DocumentInfo::MimeType ).section( '/', -1 ).toUpper();
    setCaption( i18n( "%1 Properties", mimeName ) );

    int valMaxWidth = 100;

    /* obtains the properties list, conveniently ordered */
    QStringList orderedProperties;
    orderedProperties << Okular::DocumentInfo::getKeyString( Okular::DocumentInfo::FilePath )
                      << Okular::DocumentInfo::getKeyString( Okular::DocumentInfo::PagesSize )
                      << Okular::DocumentInfo::getKeyString( Okular::DocumentInfo::DocumentSize );
    for (Okular::DocumentInfo::Key ks = Okular::DocumentInfo::Title;
                                   ks <= Okular::DocumentInfo::Keywords;
                                   ks = Okular::DocumentInfo::Key( ks+1 ) )
    {
        orderedProperties << Okular::DocumentInfo::getKeyString( ks );
    }
    foreach( const QString &ks, info.keys()) {
        if ( !orderedProperties.contains( ks ) ) {
            orderedProperties << ks;
        }
    }

    for ( QStringList::Iterator it = orderedProperties.begin();
                                it != orderedProperties.end();
                                ++it )
    {
        const QString key = *it;
        const QString titleString = info.getKeyTitle( key );
        const QString valueString = info.get( key );
        if ( titleString.isNull() || valueString.isNull() )
            continue;

        // create labels and layout them
        QWidget *value = NULL;
        if ( key == Okular::DocumentInfo::getKeyString( Okular::DocumentInfo::MimeType ) ) {
            /// for mime type fields, show icon as well
            value = new QWidget( page );
            /// place icon left of mime type's name
            QHBoxLayout *hboxLayout = new QHBoxLayout( value );
            hboxLayout->setMargin( 0 );
            /// retrieve icon and place it in a QLabel
            KMimeType::Ptr mimeType = KMimeType::mimeType( valueString );
            KSqueezedTextLabel *squeezed;
            if (!mimeType.isNull()) {
                /// retrieve icon and place it in a QLabel
                QLabel *pixmapLabel = new QLabel( value );
                hboxLayout->addWidget( pixmapLabel, 0 );
                pixmapLabel->setPixmap( KIconLoader::global()->loadMimeTypeIcon( mimeType->iconName(), KIconLoader::Small ) );
                /// mime type's name and label
                squeezed = new KSqueezedTextLabel( i18nc( "mimetype information, example: \"PDF Document (application/pdf)\"", "%1 (%2)", mimeType->comment(), valueString ), value );
            } else {
                /// only mime type name
                squeezed = new KSqueezedTextLabel( valueString, value );
            }
            squeezed->setTextInteractionFlags( Qt::TextSelectableByMouse );
            hboxLayout->addWidget( squeezed, 1 );
        } else {
            /// default for any other document information
            KSqueezedTextLabel *label = new KSqueezedTextLabel( valueString, page );
            label->setTextInteractionFlags( Qt::TextSelectableByMouse );
            value = label;
        }
        layout->addRow( new QLabel( i18n( "%1:", titleString ) ), value);

        // refine maximum width of 'value' labels
        valMaxWidth = qMax( valMaxWidth, fontMetrics().width( valueString ) );
    }

    // FONTS
    QVBoxLayout *page2Layout = 0;
    if ( doc->canProvideFontInformation() ) {
        // create fonts tab and layout it
        QFrame *page2 = new QFrame();
        m_fontPage = addPage(page2, i18n("&Fonts"));
        m_fontPage->setIcon( KIcon( "preferences-desktop-font" ) );
        page2Layout = new QVBoxLayout(page2);
        page2Layout->setMargin(marginHint());
        page2Layout->setSpacing(spacingHint());
        // add a tree view
        QTreeView *view = new QTreeView(page2);
        view->setContextMenuPolicy(Qt::CustomContextMenu);
        connect(view, SIGNAL(customContextMenuRequested(QPoint)), this, SLOT(showFontsMenu(QPoint)));
        page2Layout->addWidget(view);
        view->setRootIsDecorated(false);
        view->setAlternatingRowColors(true);
        view->setSortingEnabled( true );
        // creating a proxy model so we can sort the data
        QSortFilterProxyModel *proxymodel = new QSortFilterProxyModel(view);
        proxymodel->setDynamicSortFilter( true );
        proxymodel->setSortCaseSensitivity( Qt::CaseInsensitive );
        m_fontModel = new FontsListModel(view);
        proxymodel->setSourceModel(m_fontModel);
        view->setModel(proxymodel);
        view->sortByColumn( 0, Qt::AscendingOrder );
        m_fontInfo = new QLabel( this );
        page2Layout->addWidget( m_fontInfo );
        m_fontInfo->setText( i18n( "Reading font information..." ) );
        m_fontInfo->hide();
        m_fontProgressBar = new QProgressBar( this );
        page2Layout->addWidget( m_fontProgressBar );
        m_fontProgressBar->setRange( 0, 100 );
        m_fontProgressBar->setValue( 0 );
        m_fontProgressBar->hide();
    }

    // current width: left columnt + right column + dialog borders
    int width = layout->minimumSize().width() + valMaxWidth + 2 * marginHint() + spacingHint() + 30;
    if ( page2Layout )
        width = qMax( width, page2Layout->sizeHint().width() + marginHint() + spacingHint() + 31 );
    // stay inside the 2/3 of the screen width
    QRect screenContainer = KGlobalSettings::desktopGeometry( this );
    width = qMin( width, 2*screenContainer.width()/3 );
    resize(width, 1);

    connect( pageWidget(), SIGNAL(currentPageChanged(KPageWidgetItem*,KPageWidgetItem*)),
             this, SLOT(pageChanged(KPageWidgetItem*,KPageWidgetItem*)) );
}