ConfigureDialog::ConfigureDialog( QWidget * parent )
  : KCMultiDialog( parent )
{
  setFaceType( KPageDialog::List );
  setCaption( i18n( "Configure" ) );
#ifdef Q_OS_UNIX
  KWindowSystem::setIcons( winId(), qApp->windowIcon().pixmap( IconSize( KIconLoader::Desktop ), IconSize( KIconLoader::Desktop ) ),
                  qApp->windowIcon().pixmap( IconSize( KIconLoader::Small ), IconSize( KIconLoader::Small ) ) );
#endif
  showButton( User1, true );

  addModule( "kleopatra_config_dirserv" );
  addModule( "kleopatra_config_appear" );
  addModule( "kleopatra_config_dnorder" );
#ifdef HAVE_KLEOPATRACLIENT_LIBRARY
  addModule( "kleopatra_config_smimevalidation" );
#endif
  addModule( "kleopatra_config_gnupgsystem" );

  // We store the minimum size of the dialog on hide, because otherwise
  // the KCMultiDialog starts with the size of the first kcm, not
  // the largest one. This way at least after the first showing of
  // the largest kcm the size is kept.
  const KConfigGroup geometry( KGlobal::config(), "Geometry" );
  const int width = geometry.readEntry( "ConfigureDialogWidth", 0);
  const int height = geometry.readEntry( "ConfigureDialogHeight", 0 );
  if ( width != 0 && height != 0 ) {
     setMinimumSize( width, height );
  }

}
KNoteSimpleConfigDialog::KNoteSimpleConfigDialog(const QString &title,
        QWidget *parent)
    : QDialog(parent)
{
    QVBoxLayout *mainLayout = new QVBoxLayout(this);

    QDialogButtonBox *buttonBox = new QDialogButtonBox(QDialogButtonBox::Ok | QDialogButtonBox::Cancel, this);
    QPushButton *okButton = buttonBox->button(QDialogButtonBox::Ok);
    okButton->setDefault(true);
    okButton->setShortcut(Qt::CTRL | Qt::Key_Return);
    connect(buttonBox, &QDialogButtonBox::accepted, this, &KNoteSimpleConfigDialog::accept);
    connect(buttonBox, &QDialogButtonBox::rejected, this, &KNoteSimpleConfigDialog::reject);

    setWindowTitle(title);
    KWindowSystem::setIcons(winId(),
                            qApp->windowIcon().pixmap(
                                IconSize(KIconLoader::Desktop),
                                IconSize(KIconLoader::Desktop)),
                            qApp->windowIcon().pixmap(
                                IconSize(KIconLoader::Small),
                                IconSize(KIconLoader::Small)));
    mTabWidget = new QTabWidget;

    mEditorConfigWidget = new KNoteEditorConfigWidget(this);
    mTabWidget->addTab(mEditorConfigWidget, i18n("Editor Settings"));

    mDisplayConfigWidget = new KNoteDisplayConfigWidget(true, this);
    mTabWidget->addTab(mDisplayConfigWidget, i18n("Display Settings"));

    mainLayout->addWidget(mTabWidget);
    mainLayout->addWidget(buttonBox);

    readConfig();
}
QWidget * ToolTipManager::createTipContent( QModelIndex item )
{
    const QSize dialogIconSize = QSize(IconSize(KIconLoader::Dialog), IconSize(KIconLoader::Dialog));
    const QSize toolbarIconSize = QSize(IconSize(KIconLoader::MainToolbar), IconSize(KIconLoader::MainToolbar));

    QWidget * tipContent = new QWidget();
    QGridLayout* tipLayout = new QGridLayout();

    QLayout * primaryLine = generateToolTipLine( &item, tipContent, dialogIconSize, true );
    tipLayout->addLayout( primaryLine, 0, 0 );

    for ( int done = 0; d->view->model()->rowCount( item ) > done; done = 1 + done ) {
        QModelIndex childItem = d->view->model()->index( done, 0, item );
        QLayout * subLine = generateToolTipLine( &childItem, tipContent, toolbarIconSize, false );
        tipLayout->addLayout( subLine, done + 2, 0 );
    }

    tipLayout->setVerticalSpacing( 0 );
    tipContent->setLayout( tipLayout );

    if( d->view->model()->rowCount( item ) > 0 ) {
        QFrame * separatorLine = new QFrame( tipContent );
        separatorLine->setFrameStyle( QFrame::HLine );
        tipLayout->addWidget( separatorLine, 1, 0 );
    }

    return tipContent;
}
WindowList::WindowList(QObject *parent, const QVariantList &args) : Plasma::Applet(parent, args)
{
    setAspectRatioMode(Plasma::ConstrainedSquare);

    const int iconSize = IconSize(KIconLoader::Desktop);
    resize((iconSize * 2), (iconSize * 2));
}
void ContactDelegateCompact::setListMode(ContactDelegateCompact::ListSize size)
{
    if (size == ContactDelegateCompact::Mini) {
        m_spacing = 2;
        m_avatarSize = IconSize(KIconLoader::Toolbar);
        m_presenceIconSize = qMax(12, KGlobalSettings::smallestReadableFont().pixelSize() + m_spacing);
        m_clientTypeIconSize = qMax(12, KGlobalSettings::smallestReadableFont().pixelSize() + m_spacing);
    } else if (size == ContactDelegateCompact::Normal) {
        m_spacing = 4;
        m_avatarSize = IconSize(KIconLoader::Toolbar);
        m_presenceIconSize = IconSize(KIconLoader::Small);
        m_clientTypeIconSize = IconSize(KIconLoader::Small);
    }

    m_listSize = size;
}
void KeyboardApplet::constraintsEvent(Plasma::Constraints constraints)
{
    if (constraints & Plasma::FormFactorConstraint) {
        int iconSize;
        if (formFactor() == Plasma::Planar ||
                formFactor() == Plasma::MediaCenter) {
            iconSize = IconSize(KIconLoader::Desktop);
        } else {
            iconSize = IconSize(KIconLoader::Small);
        }
        setMinimumSize(iconSize, iconSize);
    }
    if (constraints & Plasma::SizeConstraint) {
        generatePixmap();
    }
}
void PlacesItemEditDialog::initialize()
{
    QDialogButtonBox *buttonBox = new QDialogButtonBox(QDialogButtonBox::Ok|QDialogButtonBox::Cancel);
    m_okButton = buttonBox->button(QDialogButtonBox::Ok);
    m_okButton->setDefault(true);
    m_okButton->setShortcut(Qt::CTRL | Qt::Key_Return);
    connect(buttonBox, &QDialogButtonBox::accepted, this, &PlacesItemEditDialog::accept);
    connect(buttonBox, &QDialogButtonBox::rejected, this, &PlacesItemEditDialog::reject);
    setModal(true);
    m_okButton->setDefault(true);

    QVBoxLayout *mainLayout = new QVBoxLayout;
    setLayout(mainLayout);
    QWidget* mainWidget = new QWidget(this);
    mainLayout->addWidget(mainWidget);
    mainLayout->addWidget(buttonBox);

    QVBoxLayout* vBox = new QVBoxLayout(mainWidget);

    QFormLayout* formLayout = new QFormLayout();
    vBox->addLayout( formLayout );

    m_textEdit = new QLineEdit(mainWidget);
    formLayout->addRow(i18nc("@label", "Label:"), m_textEdit);
    m_textEdit->setText(m_text);
    m_textEdit->setPlaceholderText(i18n("Enter descriptive label here"));

    m_urlEdit = new KUrlRequester(m_url, mainWidget);
    m_urlEdit->setMode(KFile::Directory);
    formLayout->addRow(i18nc("@label", "Location:"), m_urlEdit);
    // Provide room for at least 40 chars (average char width is half of height)
    m_urlEdit->setMinimumWidth(m_urlEdit->fontMetrics().height() * (40 / 2));
    connect(m_urlEdit, &KUrlRequester::textChanged, this, &PlacesItemEditDialog::slotUrlChanged);

    m_iconButton = new KIconButton(mainWidget);
    formLayout->addRow(i18nc("@label", "Choose an icon:"), m_iconButton);
    m_iconButton->setIconSize(IconSize(KIconLoader::Desktop));
    m_iconButton->setIconType(KIconLoader::NoGroup, KIconLoader::Place);
    if (m_icon.isEmpty()) {
        QMimeDatabase db;
        m_iconButton->setIcon(db.mimeTypeForUrl(m_url).iconName());
    } else {
        m_iconButton->setIcon(m_icon);
    }

    if (m_allowGlobal) {
        const QString appName = KAboutData::applicationData().displayName();
        m_appLocal = new QCheckBox( i18n("&Only show when using this application (%1)",  appName ), mainWidget );
        m_appLocal->setChecked(false);
        vBox->addWidget(m_appLocal);
    }

    if (m_text.isEmpty()) {
        m_urlEdit->setFocus();
    } else {
        m_textEdit->setFocus();
    }

}
Exemple #8
0
void DialogViewConfigurationItem::refreshItem()
{
  setFlags((flags() | Qt::ItemIsDragEnabled) &  ~Qt::ItemIsDropEnabled);
  setText(_name);
  setIcon(KIconLoader::global()->loadIcon( _iconName, KIconLoader::Small, IconSize(KIconLoader::Toolbar) ));
  setData(Qt::ToolTipRole, _id);  // a hack. I am giving up to do it right
  setData(Qt::DisplayRole, _name);
}
Exemple #9
0
void LauncherApplet::Private::initToolTip()
{
    Plasma::ToolTipManager::self()->registerWidget(q);
    Plasma::ToolTipManager::ToolTipContent data;
    data.mainText = i18n("Kickoff Application Launcher");
    data.subText = i18n("Favorites, applications, computer places, recently used items and desktop sessions");
    data.image = q->icon().pixmap(IconSize(KIconLoader::Desktop));
    Plasma::ToolTipManager::self()->setToolTipContent(q, data);
}
Exemple #10
0
void
TBarApp::FetchAppIcon(BarTeamInfo* barInfo)
{
	int32 width = IconSize();
	int32 index = (width - kMinimumIconSize) / kIconSizeInterval;

	// first look in the icon cache
	barInfo->icon = barInfo->iconCache[index];
	if (barInfo->icon != NULL)
		return;

	// icon wasn't in cache, get it from be_roster and cache it
	app_info appInfo;
	icon_size size = width >= 31 ? B_LARGE_ICON : B_MINI_ICON;
	BBitmap* icon = new BBitmap(IconRect(), kIconColorSpace);
	if (be_roster->GetAppInfo(barInfo->sig, &appInfo) == B_OK) {
		// fetch the app icon
		BFile file(&appInfo.ref, B_READ_ONLY);
		BAppFileInfo appMime(&file);
		if (appMime.GetIcon(icon, size) == B_OK) {
			delete barInfo->iconCache[index];
			barInfo->iconCache[index] = barInfo->icon = icon;
			return;
		}
	}

	// couldn't find the app icon
	// fetch the generic 3 boxes icon and cache it
	BMimeType defaultAppMime;
	defaultAppMime.SetTo(B_APP_MIME_TYPE);
	if (defaultAppMime.GetIcon(icon, size) == B_OK) {
		delete barInfo->iconCache[index];
		barInfo->iconCache[index] = barInfo->icon = icon;
		return;
	}

	// couldn't find generic 3 boxes icon
	// fill with transparent
	uint8* iconBits = (uint8*)icon->Bits();
	if (icon->ColorSpace() == B_RGBA32) {
		int32 i = 0;
		while (i < icon->BitsLength()) {
			iconBits[i++] = B_TRANSPARENT_32_BIT.red;
			iconBits[i++] = B_TRANSPARENT_32_BIT.green;
			iconBits[i++] = B_TRANSPARENT_32_BIT.blue;
			iconBits[i++] = B_TRANSPARENT_32_BIT.alpha;
		}
	} else {
		// Assume B_CMAP8
		for (int32 i = 0; i < icon->BitsLength(); i++)
			iconBits[i] = B_TRANSPARENT_MAGIC_CMAP8;
	}

	delete barInfo->iconCache[index];
	barInfo->iconCache[index] = barInfo->icon = icon;
}
Exemple #11
0
EngineExplorer::EngineExplorer(QWidget* parent)
    : QDialog(parent),
      m_engine(0),
      m_sourceCount(0),
      m_requestingSource(false),
      m_expandButton(new QPushButton(i18n("Expand All"), this)),
      m_collapseButton(new QPushButton(i18n("Collapse All"), this))
{
#ifdef FOUND_SOPRANO
    (void) qRegisterMetaType<Soprano::Node>();
#endif
    setWindowTitle(i18n("Plasma Engine Explorer"));
    QWidget* mainWidget = new QWidget(this);

    QDialogButtonBox *buttonBox = new QDialogButtonBox(this);
    buttonBox->addButton(m_expandButton, QDialogButtonBox::ActionRole);
    buttonBox->addButton(m_collapseButton, QDialogButtonBox::ActionRole);
    buttonBox->addButton(QDialogButtonBox::Close);

    QVBoxLayout *layout = new QVBoxLayout(this);
    layout->addWidget(mainWidget);
    layout->addWidget(buttonBox);
    setLayout(layout);

    connect(buttonBox, SIGNAL(rejected()), this, SLOT(reject()));

    setupUi(mainWidget);

    m_engineManager = Plasma::PluginLoader::self();
    m_dataModel = new QStandardItemModel(this);
    const QIcon pix = QIcon::fromTheme("plasma");
    const int size = IconSize(KIconLoader::Dialog);
    m_title->setPixmap(pix.pixmap(size, size));
    connect(m_engines, SIGNAL(activated(QString)), this, SLOT(showEngine(QString)));
    connect(m_sourceRequesterButton, SIGNAL(clicked(bool)), this, SLOT(requestSource()));
    connect(m_serviceRequesterButton, SIGNAL(clicked(bool)), this, SLOT(requestServiceForSource()));
    m_data->setModel(m_dataModel);
    m_data->setWordWrap(true);

    m_searchLine->setTreeView(m_data);
    m_searchLine->setPlaceholderText(i18n("Search"));

    listEngines();
    m_engines->setFocus();

    connect(m_collapseButton, SIGNAL(clicked()), m_data, SLOT(collapseAll()));
    connect(m_expandButton, SIGNAL(clicked()), m_data, SLOT(expandAll()));
    enableButtons(false);

    addAction(KStandardAction::quit(qApp, SLOT(quit()), this));

    connect(m_data, SIGNAL(customContextMenuRequested(QPoint)),
            this, SLOT(showDataContextMenu(QPoint)));
    m_data->setContextMenuPolicy(Qt::CustomContextMenu);
    connect(qApp, SIGNAL(aboutToQuit()), this, SLOT(cleanUp()));
}
Exemple #12
0
BRect
TypeIconView::BitmapRect() const
{
	if (IconSource() == kNoIcon) {
		// this also defines the drop target area
		font_height fontHeight;
		GetFontHeight(&fontHeight);

		float width = StringWidth("no icon") + 8.0f;
		float height = ceilf(fontHeight.ascent + fontHeight.descent) + 6.0f;
		float x = (Bounds().Width() - width) / 2.0f;
		float y = ceilf((IconSize() - fontHeight.ascent - fontHeight.descent) / 2.0f) - 3.0f;

		return BRect(x, y, x + width, y + height);
	}

	float x = (Bounds().Width() - IconSize()) / 2.0f;
	return BRect(x, 0.0f, x + IconSize() - 1, IconSize() - 1);
}
void
TypeIconView::Draw(BRect updateRect)
{
	if (!IsEnabled())
		return;

	IconView::Draw(updateRect);

	const char* text = NULL;

	switch (IconSource()) {
		case kNoIcon:
			text = B_TRANSLATE("no icon");
			break;
		case kApplicationIcon:
			text = B_TRANSLATE("(from application)");
			break;
		case kSupertypeIcon:
			text = B_TRANSLATE("(from super type)");
			break;

		default:
			return;
	}

	SetHighColor(tint_color(ui_color(B_PANEL_BACKGROUND_COLOR),
		B_DISABLED_LABEL_TINT));
	SetLowColor(ViewColor());

	font_height fontHeight;
	GetFontHeight(&fontHeight);

	float y = fontHeight.ascent;
	if (IconSource() == kNoIcon) {
		// center text in the middle of the icon
		y += (IconSize() - fontHeight.ascent - fontHeight.descent) / 2.0f;
	} else
		y += IconSize() + 3.0f;

	DrawString(text, BPoint(ceilf((Bounds().Width() - StringWidth(text)) / 2.0f),
		ceilf(y)));
}
void KexiObjectInfoLabel::setObjectClassIconName(const QString &iconName)
{
    d->classIconName = iconName;
    if (d->classIconName.isEmpty()) {
        d->objectIconLabel->setFixedWidth(0);
    }
    else {
        d->objectIconLabel->setFixedWidth(IconSize(KIconLoader::Small) + 2 + 2);
    }
    d->objectIconLabel->setPixmap(SmallIcon(iconName));
}
Exemple #15
0
KoContextBarButton::KoContextBarButton(const QString &iconName, QWidget* parent)
: QToolButton(parent)
, m_isHovered(false)
, m_fadingValue(0)
, m_fadingTimeLine(0)
{
    const int size = IconSize(KIconLoader::Small);
    setIconSize(QSize(size, size));
    setAutoRaise(true);
    setIcon(QIcon::fromTheme(iconName));
}
Exemple #16
0
void
TypeIconView::GetPreferredSize(float* _width, float* _height)
{
	if (_width) {
		float a = StringWidth("(from application)");
		float b = StringWidth("(from super type)");
		float width = max_c(a, b);
		if (width < IconSize())
			width = IconSize();

		*_width = ceilf(width);
	}

	if (_height) {
		font_height fontHeight;
		GetFontHeight(&fontHeight);

		*_height = IconSize() + 3.0f + ceilf(fontHeight.ascent + fontHeight.descent);
	}
}
void FileSystemSupportDialog::setupDialog()
{
    QIcon yes = QIcon::fromTheme(QStringLiteral("dialog-ok")).pixmap(IconSize(KIconLoader::Toolbar));
    QIcon no = QIcon::fromTheme(QStringLiteral("dialog-error")).pixmap(IconSize(KIconLoader::Toolbar));

    dialogWidget().tree().clear();

    foreach(const FileSystem * fs, FileSystemFactory::map()) {
        if (fs->type() == FileSystem::Unknown || fs->type() == FileSystem::Extended)
            continue;

        QTreeWidgetItem* item = new QTreeWidgetItem();

        int i = 0;
        item->setText(i++, fs->name());
        item->setIcon(i++, fs->supportCreate() ? yes : no);
        item->setIcon(i++, fs->supportGrow() ? yes : no);
        item->setIcon(i++, fs->supportShrink() ? yes : no);
        item->setIcon(i++, fs->supportMove() ? yes : no);
        item->setIcon(i++, fs->supportCopy() ? yes : no);
        item->setIcon(i++, fs->supportCheck() ? yes : no);
        item->setIcon(i++, fs->supportGetLabel() ? yes : no);
        item->setIcon(i++, fs->supportSetLabel() ? yes : no);
        item->setIcon(i++, fs->supportGetUsed() ? yes : no);
        item->setIcon(i++, fs->supportBackup() ? yes : no);

        // there is no FileSystem::supportRestore(), because we currently can't tell
        // if a file is an image of a supported or unsupported (or even invalid) filesystem
        item->setIcon(i++, yes);

        item->setText(i++, fs->supportToolName().name.isEmpty() ? QStringLiteral("---") : fs->supportToolName().name);

        dialogWidget().tree().addTopLevelItem(item);
    }

    for (int i = 0; i < dialogWidget().tree().columnCount(); i++)
        dialogWidget().tree().resizeColumnToContents(i);

    dialogWidget().tree().sortItems(0, Qt::AscendingOrder);
}
Exemple #18
0
QSizeF IconApplet::sizeHint(Qt::SizeHint which, const QSizeF & constraint) const
{
    if (which == Qt::PreferredSize) {
        int iconSize;

        switch (formFactor()) {
            case Plasma::Planar:
            case Plasma::MediaCenter:
                iconSize = IconSize(KIconLoader::Desktop);
                break;

            case Plasma::Horizontal:
            case Plasma::Vertical:
                iconSize = IconSize(KIconLoader::Panel);
                break;
        }

        return QSizeF(iconSize, iconSize);
    }

    return Plasma::Applet::sizeHint(which, constraint);
}
AddClientDialog::AddClientDialog(const QString& clientName, QWidget* parent) :
	QDialog(parent, Qt::WindowTitleHint | Qt::WindowSystemMenuHint),
	Ui::AddClientDialog(),
	m_AddResult(kAddClientIgnore),
	m_IgnoreAutoConfigClient(false)
{
	setupUi(this);

	m_pLabelHead->setText("A client wants to connect. "
					"Please choose a location for " + clientName + ".");

	QIcon icon(":res/icons/64x64/video-display.png");
	QSize IconSize(32,32);

	m_pButtonLeft = new QPushButton(this);
	m_pButtonLeft->setIcon(icon);
	m_pButtonLeft->setIconSize(IconSize);
	gridLayout->addWidget(m_pButtonLeft, 2, 0, 1, 1, Qt::AlignCenter);
	connect(m_pButtonLeft, SIGNAL(clicked()), this, SLOT(handleButtonLeft()));

	m_pButtonUp = new QPushButton(this);
	m_pButtonUp->setIcon(icon);
	m_pButtonUp->setIconSize(IconSize);
	gridLayout->addWidget(m_pButtonUp, 1, 1, 1, 1, Qt::AlignCenter);
	connect(m_pButtonUp, SIGNAL(clicked()), this, SLOT(handleButtonUp()));

	m_pButtonRight = new QPushButton(this);
	m_pButtonRight->setIcon(icon);
	m_pButtonRight->setIconSize(IconSize);
	gridLayout->addWidget(m_pButtonRight, 2, 2, 1, 1, Qt::AlignCenter);
	connect(m_pButtonRight, SIGNAL(clicked()), this, SLOT(handleButtonRight()));

	m_pButtonDown = new QPushButton(this);
	m_pButtonDown->setIcon(icon);
	m_pButtonDown->setIconSize(IconSize);
	gridLayout->addWidget(m_pButtonDown, 3, 1, 1, 1, Qt::AlignCenter);
	connect(m_pButtonDown, SIGNAL(clicked()), this, SLOT(handleButtonDown()));

	m_pLabelCenter = new QLabel(this);
	m_pLabelCenter->setPixmap(QPixmap(":res/icons/64x64/video-display.png"));
	gridLayout->addWidget(m_pLabelCenter, 2, 1, 1, 1, Qt::AlignCenter);

#if defined(Q_OS_MAC)
	m_pDialogButtonBox->setLayoutDirection(Qt::RightToLeft);
#endif

	QPushButton* advanced = m_pDialogButtonBox->addButton("Advanced",
													QDialogButtonBox::HelpRole);
	connect(advanced, SIGNAL(clicked()), this, SLOT(handleButtonAdvanced()));
}
KexiObjectInfoLabel::KexiObjectInfoLabel(QWidget* parent)
        : QWidget(parent)
        , d( new Private )
{
    QHBoxLayout *hlyr = new QHBoxLayout(this);
    hlyr->setContentsMargins(0, 0, 0, 0);
    hlyr->setSpacing(2);
    d->objectIconLabel = new QLabel(this);
    d->objectIconLabel->setMargin(2);
    setMinimumHeight(IconSize(KIconLoader::Small) + 2 + 2);
    hlyr->addWidget(d->objectIconLabel);
    d->objectNameLabel = new QLabel(this);
    d->objectNameLabel->setSizePolicy(QSizePolicy::Minimum, QSizePolicy::Preferred);
    hlyr->addWidget(d->objectNameLabel);
}
void FadingNavigationWidget::initFrame()
{
    mFrame = new Plasma::Frame(parent);
    mFrame->setZValue(10);
    QGraphicsLinearLayout* l = new QGraphicsLinearLayout();
    mPrevButton = new Plasma::PushButton(mFrame);
    mPrevButton->nativeWidget()->setIcon(QIcon::fromTheme("arrow-left"));
    mPrevButton->setSizePolicy(QSizePolicy::Minimum, QSizePolicy::Minimum);
    mPrevButton->setMaximumSize(IconSize(KIconLoader::MainToolbar), IconSize(KIconLoader::MainToolbar));
    connect(mPrevButton, SIGNAL(clicked()), this , SIGNAL(prevClicked()));
    l->addItem(mPrevButton);
    mNextButton = new Plasma::PushButton(mFrame);
    mNextButton->nativeWidget()->setIcon(QIcon::fromTheme("arrow-right"));
    mNextButton->setSizePolicy(QSizePolicy::Minimum, QSizePolicy::Minimum);
    mNextButton->setMaximumSize(IconSize(KIconLoader::MainToolbar), IconSize(KIconLoader::MainToolbar));
    connect(mNextButton, SIGNAL(clicked()), this , SIGNAL(nextClicked()));
    l->addItem(mNextButton);
    mFrame->setLayout(l);
    mFrame->setFrameShadow(Plasma::Frame::Raised);
    l->activate(); // makes sure the size is correct
    mFrame->hide();
    mFadingItem = new FadingItem(mFrame);
    mFadingItem->hide();
}
bool KexiTableViewHeader::eventFilter(QObject * watched, QEvent * e)
{
    if (e->type() == QEvent::MouseMove) {
        const int section = sectionAt(static_cast<QMouseEvent*>(e)->x());
        if (section != m_lastToolTipSection && section >= 0 && section < (int)m_toolTips.count()) {
            //QToolTip::remove(this, m_toolTipRect);
#ifdef __GNUC__
#warning TODO KexiTableViewHeader::eventFilter
#else
#pragma WARNING( TODO KexiTableViewHeader::eventFilter  )
#endif
            QString tip = m_toolTips[ section ];
            if (tip.isEmpty()) { //try label
                QFontMetrics fm(font());
                int minWidth = fm.width(label(section))
                               + style()->pixelMetric(QStyle::PM_HeaderMargin);
                QIcon *iset = iconSet(section);
                if (iset)
                    minWidth += (2 + iset->pixmap(IconSize(KIconLoader::Small)).width()); //taken from QHeader::sectionSizeHint()
                if (minWidth > sectionSize(section))
                    tip = label(section);
            }
            if (tip.isEmpty()) {
                m_lastToolTipSection = -1;
            } else {
#ifdef __GNUC__
#warning QToolTip::showText() OK?
#else
#pragma WARNING( QToolTip::showText() OK? )
#endif
                QToolTip::showText(static_cast<QMouseEvent*>(e)->globalPos(), tip,
                                   this, m_toolTipRect = sectionRect(section));
                m_lastToolTipSection = section;
            }
        }
    } else if (e->type() == QEvent::ToolTip) {
//        QHelpEvent *helpEvent = static_cast<QHelpEvent *>(e);
#ifdef __GNUC__
#warning TODO
#else
#pragma WARNING( TODO )
#endif
    }
//   if (e->type()==QEvent::MouseButtonPress) {
// todo
//   }
    return Q3Header::eventFilter(watched, e);
}
Exemple #23
0
IconApplet::IconApplet(QObject *parent, const QVariantList &args)
    : Plasma::Applet(parent, args),
      m_icon(0),
      m_watcher(0),
      m_hasDesktopFile(false)
{
    setAcceptDrops(true);
    setBackgroundHints(NoBackground);
    setHasConfigurationInterface(true);
    m_icon = new Plasma::IconWidget(this);

    if (!args.isEmpty()) {
        setUrl(args.value(0).toString());
    }

    resize(m_icon->sizeFromIconSize(IconSize(KIconLoader::Desktop)));
    //kDebug() << "sized to:" << geometry();
}
Exemple #24
0
void Options::randomTrack()
{
   Plasma::ToolTipContent data;
   data.setSubText(i18n("Play random track"));
   data.setImage(KIcon("roll").pixmap(IconSize(KIconLoader::Desktop)));
   if (randomFlag) {
       data.setMainText(i18n("Random - off"));
       randomFlag = false;
       emit activeRandom(false);
   }
   else {
       data.setMainText(i18n("Random - on"));
       randomFlag = true;
       emit activeRandom(true);
   }

   Plasma::ToolTipManager::self()->setContent(m_random, data);
}
Exemple #25
0
void Options::loopList()
{
   Plasma::ToolTipContent data;
   data.setSubText(i18n("Play again the tracklist"));
   data.setImage(KIcon("object-rotate-right").pixmap(IconSize(KIconLoader::Desktop)));
   
   if (loopFlag) {
       data.setMainText(i18n("Repeat - off"));
       loopFlag = false;
       emit activeRepeat(false);
   }
   else {
       data.setMainText(i18n("Repeat - on"));
       loopFlag = true;
       emit activeRepeat(true);
   }

   Plasma::ToolTipManager::self()->setContent(m_loop, data);
}
QSize KexiRelationsTableFieldList::sizeHint() const
{
    QFontMetrics fm(fontMetrics());

// kdDebug() << schema()->name() << " cw=" << columnWidth(0) + fm.width("i")
//  << ", " << fm.width(schema()->name()+"  ");

    int maxWidth = -1;
    const int iconWidth = IconSize(KIconLoader::Small) + fm.width("i") + 20;
    for (Q3ListViewItem *item = firstChild(); item; item = item->nextSibling())
        maxWidth = qMax(maxWidth, iconWidth + fm.width(item->text(0)));

    const uint rowCount = qMin(8, childCount());

    QSize s(
        qMax(maxWidth, fm.width(schema()->name() + " ")),
        rowCount*firstChild()->totalHeight() + 4);
    return s;
}
KexiProjectStorageTypeSelectionPage::KexiProjectStorageTypeSelectionPage(QWidget* parent)
 : KexiAssistantPage(i18n("Storage Method"),
                  i18n("Select a storage method which will be used to store the new project."),
                  parent)
 , m_fileTypeSelected(true)
{
    setBackButtonVisible(true);
    QWidget* contents = new QWidget;
    setupUi(contents);
    const int dsize = IconSize(KIconLoader::Desktop);
    btn_file->setIcon(KIcon(KexiDB::defaultFileBasedDriverIconName()));
    btn_file->setIconSize(QSize(dsize, dsize));
    connect(btn_file, SIGNAL(clicked()), this, SLOT(buttonClicked()));
    btn_server->setIcon(KIcon(KEXI_DATABASE_SERVER_ICON_NAME));
    btn_server->setIconSize(QSize(dsize, dsize));
    connect(btn_server, SIGNAL(clicked()), this, SLOT(buttonClicked()));
    setFocusWidget(btn_file);

    setContents(contents);
}
KexiMainImportExportPage::KexiMainImportExportPage(
    KexiImportExportAssistant *assistant,
    QWidget* parent)
 : KexiAssistantPage(stripText(assistant->action_project_import_export_send->text()),
                     QString(),
                     parent)
{
    setNextButtonVisible(false);

    QWidget* contents = new QWidget;
    setupUi(contents);
    btn_import->setText(stripText(assistant->action_import_project->text()));
    btn_import->setDescription(assistant->action_import_project->toolTip());
    const int dsize = IconSize(KIconLoader::Desktop);
    btn_import->setIcon(assistant->action_import_project->icon());
    btn_import->setIconSize(QSize(dsize, dsize));
    connect(btn_import, SIGNAL(clicked()), assistant, SIGNAL(importProject()));

    setFocusWidget(contents);
    setContents(contents);
}
Exemple #29
0
bool ArkViewer::viewInInternalViewer(const QString& fileName, const QMimeType &mimeType)
{
    setWindowFilePath(fileName);

    // Set icon and comment for the mimetype.
    m_iconLabel->setPixmap(QIcon::fromTheme(mimeType.iconName()).pixmap(IconSize(KIconLoader::Small), IconSize(KIconLoader::Small)));
    m_commentLabel->setText(mimeType.comment());

    // Create the ReadOnlyPart instance.
    m_part = KMimeTypeTrader::self()->createPartInstanceFromQuery<KParts::ReadOnlyPart>(mimeType.name(), this, this);

    // Drop the KHTMLPart, if necessary.
    const KService::Ptr service = KMimeTypeTrader::self()->preferredService(mimeType.name(), QStringLiteral("KParts/ReadOnlyPart"));
    qCDebug(ARK) << "Preferred service for mimetype" << mimeType.name() << "is" << service->library();
    if (service.constData()->desktopEntryName() == QLatin1String("khtml")) {
        KService::List offers = KMimeTypeTrader::self()->query(mimeType.name(), QStringLiteral("KParts/ReadOnlyPart"));
        offers.removeFirst();
        qCDebug(ARK) << "Removed KHTMLPart from the offers for mimetype" << mimeType.name()
                     << ". Using" << offers.first().constData()->desktopEntryName() << "instead.";
        m_part = offers.first().constData()->createInstance<KParts::ReadOnlyPart>(this, this);
    }

    if (!m_part.data()) {
        return false;
    }

    // Insert the KPart into its placeholder.
    centralWidget()->layout()->replaceWidget(m_partPlaceholder, m_part.data()->widget());

    createGUI(m_part.data());
    setAutoSaveSettings(QStringLiteral("Viewer"), true);

    m_part.data()->openUrl(QUrl::fromLocalFile(fileName));
    m_part.data()->widget()->setFocus();
    m_fileName = fileName;

    return true;
}
 gfx::Rect CustomFrameView::IconBounds() const
 {
     int size = IconSize();
     int frame_thickness = FrameBorderThickness();
     // Our frame border has a different "3D look" than Windows'.  Theirs has a
     // more complex gradient on the top that they push their icon/title below;
     // then the maximized window cuts this off and the icon/title are centered
     // in the remaining space.  Because the apparent shape of our border is
     // simpler, using the same positioning makes things look slightly uncentered
     // with restored windows, so when the window is restored, instead of
     // calculating the remaining space from below the frame border, we calculate
     // from below the 3D edge.
     int unavailable_px_at_top = frame_->IsMaximized() ? frame_thickness
         : kTitlebarTopAndBottomEdgeThickness;
     // When the icon is shorter than the minimum space we reserve for the caption
     // button, we vertically center it.  We want to bias rounding to put extra
     // space above the icon, since the 3D edge (+ client edge, for restored
     // windows) below looks (to the eye) more like additional space than does the
     // 3D edge (or nothing at all, for maximized windows) above; hence the +1.
     int y = unavailable_px_at_top + (NonClientTopBorderHeight() -
         unavailable_px_at_top - size - TitlebarBottomThickness() + 1) / 2;
     return gfx::Rect(frame_thickness+kIconLeftSpacing, y, size, size);
 }