Пример #1
0
UnlockArea::UnlockArea(QGraphicsItem *parent) :
    MStylableWidget(parent),
    m_enabled(false),
    m_active(false)
{
    QGraphicsLinearLayout   *layout =
        new QGraphicsLinearLayout (Qt::Vertical);

    setObjectName ("LockLandArea");

    // Create the unlock icon
    MImageWidget    *unlock_icon;

    unlock_icon = new MImageWidget;
    unlock_icon->setImage ("icon-m-common-unlocked", QSize (32, 32));
    unlock_icon->setZoomFactor (1.0);
    unlock_icon->setObjectName ("LockScreenUnlockIcon");

    m_unlock_icon = new MWidget;
    QGraphicsLinearLayout   *icon_layout =
        new QGraphicsLinearLayout (Qt::Horizontal);
    icon_layout->addStretch ();
    icon_layout->addItem (unlock_icon);
    icon_layout->addStretch ();
    m_unlock_icon->setLayout (icon_layout);

    // Add the unlock icon centered
    layout->addStretch ();
    layout->addItem (m_unlock_icon);
    layout->addStretch ();

    setLayout (layout);

    updateState ();
}
QGraphicsWidget* StatusIndicatorMenuDropDownView::createTopRow()
{
    // Create an extension area for the top row plugins
    settingsPluginsExtensionArea = new MApplicationExtensionArea("com.meego.core.MStatusIndicatorMenuExtensionInterface/1.0");
    connect(settingsPluginsExtensionArea, SIGNAL(extensionInstantiated(MApplicationExtensionInterface*)), controller, SLOT(setStatusIndicatorMenuInterface(MApplicationExtensionInterface*)));
    settingsPluginsExtensionArea->setObjectName("StatusIndicatorMenuTopRowExtensionArea");
    settingsPluginsExtensionArea->setInProcessFilter(QRegExp("/statusindicatormenu-(volume|alarms|internetconnection|presence|profile).desktop$"));
    settingsPluginsExtensionArea->setOutOfProcessFilter(QRegExp("$^"));
    settingsPluginsExtensionArea->setOrder((QStringList()  << "statusindicatormenu-volume.desktop" << "statusindicatormenu-alarms.desktop" << "statusindicatormenu-internetconnection.desktop" << "statusindicatormenu-presence.desktop" << "statusindicatormenu-profile.desktop"));

    // Create a button for accessing the full settings
    //% "Settings"
    MButton *settingsButton = new MButton(qtTrId("qtn_stat_menu_settings"));
    settingsButton->setObjectName("StatusIndicatorMenuTopRowExtensionButton");
    settingsButton->setViewType(MButton::iconType);
    settingsButton->setIconID("icon-m-status-menu-settings");
    connect(settingsButton, SIGNAL(clicked()), controller, SLOT(launchControlPanelAndHide()));

    // Put the extension area and the settings button to a horizontal layout
    QGraphicsLinearLayout *topRowLayout = new QGraphicsLinearLayout(Qt::Horizontal);
    topRowLayout->setContentsMargins(0, 0, 0, 0);
    topRowLayout->setSpacing(0);
    topRowLayout->addStretch();
    topRowLayout->addItem(settingsPluginsExtensionArea);
    topRowLayout->addItem(settingsButton);
    topRowLayout->addStretch();

    // Create a container widget for extension area and settings button layout
    MWidgetController *topRowWidget = new MStylableWidget;
    topRowWidget->setStyleName("StatusIndicatorMenuExtensionAreaWidget");
    topRowWidget->setLayout(topRowLayout);

    return topRowWidget;
}
StatusIndicatorMenuVerticalView::StatusIndicatorMenuVerticalView(StatusIndicatorMenu *controller) :
    MSceneWindowView(controller),
    controller(controller)
{
    // Create an extension area for the top row plugins
    MApplicationExtensionArea *extensionArea = new MApplicationExtensionArea("com.meego.core.MStatusIndicatorMenuExtensionInterface/1.0");
    connect(extensionArea, SIGNAL(extensionInstantiated(MApplicationExtensionInterface*)), controller, SLOT(setStatusIndicatorMenuInterface(MApplicationExtensionInterface*)));
    connect(extensionArea, SIGNAL(extensionInstantiated(MApplicationExtensionInterface*)), this, SLOT(setExtensionLayoutPosition(MApplicationExtensionInterface*)));
    extensionArea->setObjectName("StatusIndicatorMenuExtensionArea");
    setSafeMode(extensionArea, QFile(CRASH_FILE).exists());
    extensionArea->init();

    // Add panning to the expension area
    MPannableViewport* viewport = new MPannableViewport();
    viewport->setWidget(extensionArea);
    viewport->setVerticalPanningPolicy(MPannableWidget::PanningAsNeeded);
    viewport->setStyleName("StatusIndicatorMenuViewport");
    viewport->positionIndicator()->setStyleName("CommonPositionIndicatorInverted");

    // Put the extension area to a horizontal layout
    QGraphicsLinearLayout *vlayout = new QGraphicsLinearLayout(Qt::Vertical);
    vlayout->setContentsMargins(0, 0, 0, 0);
    vlayout->setSpacing(0);
    vlayout->addItem(viewport);

    // Add a separator line on the bottom of the menu
    MStylableWidget *bottomSeparator = new MStylableWidget;
    bottomSeparator->setStyleName("StatusIndicatorMenuBottomSeparator");
    bottomSeparator->setLayoutPosition(M::VerticalTopPosition);
    vlayout->addItem(bottomSeparator);

    // Create a container widget for extension area and settings button layout
    containerWidget = new MStylableWidget;
    containerWidget->setStyleName("StatusIndicatorMenuExtensionAreaWidget");
    containerWidget->setLayout(vlayout);

    QGraphicsLinearLayout *hlayout = new QGraphicsLinearLayout(Qt::Horizontal);
    hlayout->setContentsMargins(0, 0, 0, 0);
    hlayout->setSpacing(0);
    hlayout->addStretch();
    hlayout->addItem(containerWidget);
    hlayout->addStretch();

    // Add a separator line on the right of the menu
    MStylableWidget *rightSeparator = new MStylableWidget;
    rightSeparator->setStyleName("StatusIndicatorMenuRightSeparator");
    rightSeparator->setLayoutPosition(M::HorizontalLeftPosition);
    hlayout->addItem(rightSeparator);

    controller->setLayout(hlayout);
    containerWidget->installEventFilter(this);
}
GalleryEnlargeShrinkAboutWidget::GalleryEnlargeShrinkAboutWidget() :
    MWidgetController(),
    m_aboutLabel(new MLabel),
    m_disclaimerLabel(new MLabel)
{
    m_disclaimerLabel->setStyleName("EnlargeShrinkAboutDisclaimer");
    m_disclaimerLabel->setText("Enlarge Shrink plugin has been proudly brought to you "
                               "by <a href=\"http://www.igalia.com\">Igalia</a>");

    m_aboutLabel->setStyleName("EnlargeShrinkAboutLink");
    m_aboutLabel->setText("<a href=\"about\">About</a>");


    connect(m_disclaimerLabel, SIGNAL(linkActivated(QString)),
            this, SIGNAL(linkActivated(QString)));
    connect(m_aboutLabel, SIGNAL(linkActivated(QString)),
            this, SIGNAL(linkActivated(QString)));

    QGraphicsLinearLayout* mainLayout = new QGraphicsLinearLayout(Qt::Horizontal);
    mainLayout->setContentsMargins(0, 0, 0, 0);
    mainLayout->addItem(m_disclaimerLabel);
    mainLayout->addStretch();
    mainLayout->addItem(m_aboutLabel);

    setLayout(mainLayout);
}
MPannableViewport* StatusIndicatorMenuDropDownView::createPannableArea()
{
    // Create pannable area contents
    statusIndicatorExtensionArea = createVerticalExtensionArea();

    QGraphicsLinearLayout *contentLayout = new QGraphicsLinearLayout(Qt::Vertical);
    contentLayout->setContentsMargins(0, 0, 0, 0);
    contentLayout->setSpacing(0);
    contentLayout->addItem(statusIndicatorExtensionArea);

    MWidgetController *contentWidget = new MStylableWidget;
    contentWidget->setStyleName("StatusIndicatorMenuContentWidget");
    contentWidget->setLayout(contentLayout);

    QGraphicsLinearLayout *pannableLayout = new QGraphicsLinearLayout(Qt::Vertical);
    pannableLayout->setContentsMargins(0, 0, 0, 0);
    pannableLayout->setSpacing(0);
    pannableLayout->addItem(contentWidget);
    QGraphicsWidget *closeButtonRow = createCloseButtonRow();
    pannableLayout->addItem(closeButtonRow);
    pannableLayout->addStretch();

    // Create a container widget for the pannable area
    PannedWidgetController *pannedWidget = new PannedWidgetController;
    pannedWidget->setLayout(pannableLayout);
    pannedWidget->setBottommostWidget(closeButtonRow);
    connect(pannedWidget, SIGNAL(positionOrSizeChanged()), this, SLOT(setPannabilityAndLayout()));
    connect(pannedWidget, SIGNAL(pressedOutSideContents()), controller, SIGNAL(hideRequested()));

    // Setup the pannable viewport
    MPannableViewport *pannableViewport = new MPannableViewport;
    pannableViewport->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding);
    pannableViewport->setWidget(pannedWidget);
    return pannableViewport;
}
void MMashupCanvasViewPrivate::init()
{
    MLayout *dl = new MLayout;
    dl->setAnimation(NULL);
    layout = dl;
    mainLayout->addItem(layout);
    layoutPolicy = new MFlowLayoutPolicy(dl);
    appletInventoryButton = new MButton;
    appletInventory = new MAppletInventory;
    appletInventoryWindow = new MModalSceneWindow;
    appletInventoryViewport = new MPannableViewport(appletInventoryWindow);

    // Put the applet inventory inside a viewport
    appletInventoryViewport->setWidget(appletInventory);

    // TODO: FIXME - this needs to have the scene specified,
    // temporarily uses currently active MWindow's scene.
    QSize sceneSize = MApplication::activeWindow()->visibleSceneSize();

    appletInventoryViewport->setMinimumSize(sceneSize);
    appletInventoryViewport->setMaximumSize(sceneSize);

    // Create a dialog layout
    QGraphicsLinearLayout *dialogLayout = new QGraphicsLinearLayout();
    dialogLayout->setContentsMargins(0, 0, 0, 0);
    dialogLayout->addItem(appletInventoryViewport);
    appletInventoryWindow->setLayout(dialogLayout);
    appletInventoryWindow->setObjectName("MAppletInventoryWindow");

    // Create an applet inventory button
    appletInventoryButton->setObjectName("MAppletInventoryButton");
    //~ uispec-document ??? FIXME
    //% "Applet Library"
    appletInventoryButton->setText(qtTrId("qtn_appl_inventory"));

    // Add the applet inventory button to a horizontal layout for centering
    QGraphicsLinearLayout *l = new QGraphicsLinearLayout(Qt::Horizontal);
    l->setContentsMargins(0, 0, 0, 0);
    l->addStretch();
    l->addItem(appletInventoryButton);
    l->addStretch();

    // Add the horizontal layout to the main layout
    mainLayout->addItem(l);
}
PanelDesktopInterface::PanelDesktopInterface(
	Yawp::ConfigData * configData,
	StateMachine * stateMachine,
	QGraphicsItem * parent,
	Qt::WindowFlags wFlags)
    : QGraphicsWidget(parent, wFlags)
{
	m_painter = new DesktopPainter(this, configData, stateMachine);
	
	m_busyWidget = new Plasma::BusyWidget();
	m_busyWidget->setAcceptHoverEvents(false);
	m_busyWidget->setAcceptedMouseButtons(Qt::NoButton);

	QGraphicsLinearLayout * mainLayout = new QGraphicsLinearLayout(this);
	mainLayout->addStretch();
	mainLayout->addItem(m_busyWidget);
	mainLayout->addStretch();

	setBusy(false);
}
QuickLaunchBarView::QuickLaunchBarView(QuickLaunchBar *controller) : MWidgetView(controller),
    launcherButtonLayout(new QGraphicsLinearLayout(Qt::Horizontal)),
    toggleLauncherButton(new MButton)
{
    QGraphicsLinearLayout *l = new QGraphicsLinearLayout(Qt::Horizontal);
    l->setContentsMargins(0, 0, 0, 0);
    controller->setLayout(l);

    // A layout for the launcher buttons
    launcherButtonLayout->setContentsMargins(0, 0, 0, 0);

    // Create launcher button
    toggleLauncherButton->setViewType("icon");
    toggleLauncherButton->setObjectName("ToggleLauncherButton");
    toggleLauncherButton->setIconID("icon-m-quicklaunchbar-menu-open");
    connect(toggleLauncherButton, SIGNAL(clicked()), controller, SIGNAL(toggleLauncherButtonClicked()));

    // Put the stuff into a layout
    l->addStretch();
    l->addItem(launcherButtonLayout);
    l->addStretch();
}
Пример #9
0
SessionWidget::SessionWidget( QGraphicsItem * parent, Qt::WindowFlags wFlags)
  : QGraphicsWidget ( parent, wFlags)
{
  this->setFocusPolicy(Qt::ClickFocus);

   m_signalMapper = new QSignalMapper(this);

  QGraphicsLinearLayout* mainLayout = new QGraphicsLinearLayout(Qt::Vertical);
  mainLayout->setSpacing(0);
  mainLayout->addStretch();
  this->setLayout(mainLayout);

  connect( m_signalMapper, SIGNAL(mapped(int)),
           this, SLOT(slotSwitchSession(int)));

  Q_ASSERT(mainLayout->count() == 0);

  //Cache the icon pixmaps
  QSize iconSize = QSize(KIconLoader::SizeSmallMedium, KIconLoader::SizeSmallMedium);

  SessList sessions;
  KDisplayManager manager;
  manager.localSessions(sessions);

  QList<QGraphicsWidget*> entries;

  foreach(SessEnt session, sessions) {
    QPixmap pixmap;
    KUser user (session.user);
    if (!user.isValid())
      continue;

    if (session.tty)
      continue;

    Plasma::IconWidget* entry = createButton(this);
    pixmap = getUserIcon(user);

    entry->setIcon(pixmap);

    QString username = getUsername(false, user);
    entry->setText(username);

    connect(entry, SIGNAL(clicked()), m_signalMapper, SLOT(map()));
    m_signalMapper->setMapping(entry, session.vt);

    if (session.self)
      entry->setEnabled(false);

    entries << entry;
  }
MWidgetController *MSettingsLanguageSettingsFactory::createWidget(const MSettingsLanguageSettings &settingsItem, MSettingsLanguageWidget &rootWidget, MDataStore *dataStore)
{
    // Create content layout to layout content items in
    QGraphicsLinearLayout *layout = new QGraphicsLinearLayout(Qt::Vertical);
    layout->setContentsMargins(0, 0, 0, 0);
    layout->setSpacing(0);

    MStylableWidget *widget = new MStylableWidget;
    widget->setStyleName("MSettingsLanguage");
    widget->setLayout(layout);

    createChildren(layout, settingsItem, rootWidget, dataStore);
    layout->addStretch();

    return widget;
}
NotificationAreaView::NotificationAreaView(NotificationArea *controller) :
    MWidgetView(controller),
    bannerLayout(new MLayout()),
    clearButtonLayout(new QGraphicsLinearLayout(Qt::Horizontal)),
    //% "Clear"
    clearButton(new MButton(qtTrId("qtn_noti_clear"))),
    andMore(new MStylableWidget)
{
    // Set up the main layout
    QGraphicsLinearLayout *mainLayout = new QGraphicsLinearLayout(Qt::Vertical);
    mainLayout->setContentsMargins(0, 0, 0, 0);
    mainLayout->setSpacing(0);
    mainLayout->addItem(bannerLayout);
    mainLayout->addItem(andMore);
    mainLayout->addItem(clearButtonLayout);
    controller->setLayout(mainLayout);

    // Set up the banner layout
    bannerPolicy = new MLinearLayoutPolicy(bannerLayout, Qt::Vertical);
    bannerPolicy->setStyleName("NotificationAreaBannerLayoutPolicy");
    bannerLayout->setContentsMargins(0, 0, 0, 0);
    bannerLayout->setPolicy(bannerPolicy);

    // Create the "and more" area
    andMore->setStyleName("AndMore");
    andMore->setVisible(false);
    //% "And more"
    MLabel *andMoreLabel = new MLabel(qtTrId("qtn_noti_and_more"));
    andMoreLabel->setStyleName("AndMoreLabel");
    QGraphicsLinearLayout *andMoreLayout = new QGraphicsLinearLayout(Qt::Horizontal);
    andMoreLayout->setContentsMargins(0, 0, 0, 0);
    andMoreLayout->setSpacing(0);
    andMoreLayout->addStretch();
    andMoreLayout->addItem(andMoreLabel);
    andMore->setLayout(andMoreLayout);

    // Put a clear button into the clear button layout
    clearButtonLayout->setContentsMargins(0, 0, 0, 0);
    clearButtonLayout->setSpacing(0);
    clearButton->setStyleName("NotificationAreaClearButton");
    connect(clearButton, SIGNAL(clicked()), controller, SLOT(removeAllRemovableBanners()));
    clearButtonLayout->addStretch();
    clearButtonLayout->addItem(clearButton);
    clearButtonLayout->addStretch();
}
Пример #12
0
MToggleWidget::MToggleWidget(QGraphicsItem *parent, QImage icon, QString iconId, bool isToggle) :
    MWidget(parent),
    m_stateImage(NULL)
{
    QGraphicsLinearLayout *layout = new QGraphicsLinearLayout(Qt::Vertical, this);
    MFeedback* feedback = new MFeedback(FEEDBACK_PATTERN, this);
    connect(this, SIGNAL(pressed()), feedback, SLOT(play()));

    m_iconWidget = new MImageWidget(this);
    m_iconWidget->setAspectRatioMode(Qt::KeepAspectRatio);
    m_iconWidget->setMinimumSize(64, 64);
    m_iconWidget->setMaximumSize(64, 64);

    setMinimumSize(80, 80);
    setMaximumSize(80, 80);

    bool weHaveAnImage = false;

    if (!iconId.isEmpty()) {
        weHaveAnImage = true;
        m_iconWidget->setImage(iconId);
    }

    if (!icon.isNull() && !weHaveAnImage) {
        weHaveAnImage = true;
        m_iconWidget->setImage(icon);
    }

    layout->addItem(m_iconWidget);
    layout->setSpacing(0.1);

    if (isToggle) {
        m_stateImage = new MImageWidget(this);
        m_stateImage->setMinimumSize(60, 20);
        m_stateImage->setMaximumSize(60, 20);
        m_stateImage->setAspectRatioMode(Qt::KeepAspectRatio);
        m_stateImage->setImage(QImage(OFF_SWITCH));
        layout->addItem(m_stateImage);
        layout->setAlignment(m_stateImage, Qt::AlignHCenter);
    } else {
        layout->addStretch();
    }
}
Пример #13
0
void LoginSheet::createCentralWidget()
{
    QGraphicsLinearLayout *mainLayout = new QGraphicsLinearLayout(Qt::Vertical,
                                                                  centralWidget());
    mainLayout->setContentsMargins(0,0,0,0);
    mainLayout->setSpacing(0);

    //% "Connect to Service"
    MLabel *label = new MLabel(qtTrId("xx_wg_sheets_connect_service"));
    label->setStyleName("CommonTitle");
    label->setSizePolicy(QSizePolicy::Preferred, QSizePolicy::Fixed);
    mainLayout->addItem(label);

    mainLayout->addItem(createSpacer());

    //% "Username:"******"xx_wg_sheets_username"));
    label->setStyleName("CommonFieldLabel");

    mainLayout->addItem(label);

    userNameTextEdit = new MTextEdit;
    userNameTextEdit->setStyleName("CommonSingleInputFieldLabeled");
    mainLayout->addItem(userNameTextEdit);

    mainLayout->addItem(createSpacer());

    //% "Password:"******"xx_wg_sheets_password"));
    label->setStyleName("CommonFieldLabel");
    mainLayout->addItem(label);

    MTextEdit *textEdit = new MTextEdit;
    textEdit->setStyleName("CommonSingleInputFieldLabeled");
    textEdit->setEchoMode(MTextEditModel::Password);
    mainLayout->addItem(textEdit);

    mainLayout->addStretch();
}
Пример #14
0
RaptorGraphicsWidget::RaptorGraphicsWidget(QGraphicsItem *parent, const KConfigGroup &appletconfig)
    : QGraphicsWidget(parent),
      d(new Private(this))
{
    setAcceptHoverEvents(true);

    d->model = new Kickoff::ApplicationModel(this);
    d->model->init();
    d->searchModel = new Kickoff::SearchModel();
    d->favoritesModel = new Kickoff::FavoritesModel(this);

    d->view = new RaptorGraphicsView(this);//Initialize the view as first element, some depend on it
    d->view->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding);
    d->view->setModel(d->model);

    d->leftScrollButton = new RaptorScrollButton(RaptorScrollButton::Left, this);
//     d->view = new RaptorItemsView();
//     RaptorItemDelegate *delegate = new RaptorItemDelegate();

    d->breadCrumb = new Breadcrumb(d->view, this);
    d->searchLine = new Plasma::LineEdit(this);
    d->favoritesIcon = new Plasma::IconWidget(this);
    d->favoritesIcon->setSizePolicy(QSizePolicy::Maximum, QSizePolicy::Maximum);
    d->favoritesIcon->setIcon(KIcon("rating"));
    //d->searchLine->setSizePolicy(QSizePolicy::Maximum, QSizePolicy::Maximum);
    d->rightScrollButton = new RaptorScrollButton(RaptorScrollButton::Right, this);
    d->appletConfig = appletconfig;

    QGraphicsLinearLayout *verticalLayout = new QGraphicsLinearLayout(Qt::Vertical);

    QGraphicsLinearLayout *horizontalLayout = new QGraphicsLinearLayout();
    horizontalLayout->addItem(d->breadCrumb);
    horizontalLayout->addStretch();
    horizontalLayout->addItem(d->favoritesIcon);
    horizontalLayout->addItem(d->searchLine);

    verticalLayout->addItem(horizontalLayout);
    QGraphicsLinearLayout *layout = new QGraphicsLinearLayout();
    layout->setOrientation(Qt::Horizontal);

    connect(d->leftScrollButton, SIGNAL(clicked()), d->view, SLOT(scrollLeft()));
    layout->addItem(d->leftScrollButton);

    layout->addItem(d->view);

    connect(d->rightScrollButton, SIGNAL(clicked()), d->view, SLOT(scrollRight()));
    layout->addItem(d->rightScrollButton);

    verticalLayout->addItem(layout);

    setLayout(verticalLayout);
// 
//     delegate->setTextColor(Plasma::Theme::defaultTheme()->color(Plasma::Theme::TextColor));
// 
//     // let's make the view nicer in the applet
//     d->view->setAttribute(Qt::WA_NoSystemBackground);
//     d->view->viewport()->setAutoFillBackground(true);
//     QPalette p = d->view->viewport()->palette();
//     p.setColor(QPalette::Base, Qt::transparent);
//     d->view->viewport()->setPalette(p);
// 
//     d->view->setModel(d->model);
//     d->view->setItemDelegate(delegate);
// 
//     d->view->hideScrollBars();
// 
//     d->proxy = new QGraphicsProxyWidget(this);
//    d->proxy->setWidget(d->view);

    KConfigGroup config(&d->appletConfig, "PlasmaRunnerManager");
    KConfigGroup conf(&config, "Plugins");

    conf.writeEntry("servicesEnabled", true);

    KService::List offers = KServiceTypeTrader::self()->query("Plasma/Runner");

    foreach (const KService::Ptr &service, offers) {
        KPluginInfo description(service);
        QString runnerName = description.pluginName();

        if (runnerName != "services")
        {
            conf.writeEntry(QString(runnerName + "Enabled"), false);
        }
    }
Пример #15
0
SendMessageWidget::SendMessageWidget(DataEngine* engine, QGraphicsWidget* parent)
        : Frame(parent),
        m_engine(engine),
        m_personWatch(engine)
{
    m_updateTimer.setInterval(1000);
    m_updateTimer.setSingleShot(true);

    int avatarSize = KIconLoader::SizeMedium;
    int actionSize = KIconLoader::SizeSmallMedium;
    
    Label* title = new Label;
    title->setText(i18n("<b>Send message</b>"));

    // Recipient
    m_image = new ContactImage(m_engine);
    m_image->setMinimumHeight(avatarSize);
    m_image->setMinimumWidth(avatarSize);
    m_image->setSizePolicy(QSizePolicy::Fixed, QSizePolicy::Fixed);
    m_toLabel = new Label;
    m_toEdit = new LineEdit;
    
    QGraphicsGridLayout* toLayout = new QGraphicsGridLayout;
    toLayout->setColumnFixedWidth(0, avatarSize * 1.2);
    toLayout->addItem(m_image, 0, 0, 2, 1);
    toLayout->addItem(m_toLabel, 0, 1);
    toLayout->addItem(m_toEdit, 1, 1);

    Label* subjectLabel = new Label;
    subjectLabel->setText(i18n("Subject:"));

    m_subject = new LineEdit;

    Label* bodyLabel = new Label;
    bodyLabel->setText(i18n("Message:"));

    Frame* bodyFrame = new Frame(this);
    bodyFrame->setFrameShadow(Sunken);
    bodyFrame->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding);
    m_body = new TextEdit;
    (new QGraphicsLinearLayout(bodyFrame))->addItem(m_body);

    Plasma::IconWidget* cancel = new Plasma::IconWidget;
    cancel->setIcon("go-previous-view");
    cancel->setToolTip(i18n("Back"));
    cancel->setMinimumHeight(actionSize);
    cancel->setMaximumHeight(actionSize);
    cancel->setMinimumWidth(actionSize);
    cancel->setMaximumWidth(actionSize);

    m_submit = new Plasma::IconWidget;
    m_submit->setIcon("mail-send");
    m_submit->setToolTip(i18n("Send"));
    m_submit->setMinimumHeight(actionSize);
    m_submit->setMaximumHeight(actionSize);
    m_submit->setMinimumWidth(actionSize);
    m_submit->setMaximumWidth(actionSize);
    m_submit->setEnabled(false);

    QGraphicsLinearLayout* buttonLayout = new QGraphicsLinearLayout(Qt::Horizontal);
    buttonLayout->addItem(cancel);
    buttonLayout->addStretch();
    buttonLayout->addItem(m_submit);

    QGraphicsLinearLayout* layout = new QGraphicsLinearLayout(Qt::Vertical, this);
    layout->addItem(title);
    layout->addItem(toLayout);
    layout->addItem(subjectLabel);
    layout->addItem(m_subject);
    layout->addItem(bodyLabel);
    layout->addItem(bodyFrame);
    layout->addItem(buttonLayout);

    connect(m_submit, SIGNAL(clicked()), SLOT(send()));
    connect(cancel, SIGNAL(clicked()), SIGNAL(done()));
    connect(&m_updateTimer, SIGNAL(timeout()), SLOT(updateTo()));
    connect(m_toEdit, SIGNAL(editingFinished()), SLOT(updateTo()));
    connect(m_toEdit, SIGNAL(textEdited(QString)), SLOT(updateSendAction()));
    connect(m_toEdit, SIGNAL(textEdited(QString)), SLOT(toChanged(QString)));
    connect(m_toEdit, SIGNAL(returnPressed()), SLOT(switchToSubject()));
    connect(&m_personWatch, SIGNAL(updated()), SLOT(personUpdated()));
    connect(m_subject, SIGNAL(textEdited(QString)), SLOT(updateSendAction()));
    connect(m_subject, SIGNAL(returnPressed()), SLOT(switchToBody()));
    connect(m_body, SIGNAL(textChanged()), SLOT(updateSendAction()));
}
Пример #16
0
RaptorGraphicsWidget::RaptorGraphicsWidget(QGraphicsItem *parent, const KConfigGroup &appletconfig)
    : QGraphicsWidget(parent),
      d(new Private(this))
{
    setAcceptHoverEvents(true);

//     d->model = new Kickoff::ApplicationModel(this);
//     d->model->init();
    if (!Nepomuk::ResourceManager::instance()->init()) {
        kDebug() << "f*****g nepomuk never dies";
        d->model = new Raptor::NepomukModel(this);
    } else {
        KNotification::event(KNotification::Error, i18n("Nepomuk is not running. Falling back to useless mode!!!"));
        d->model = new Kickoff::ApplicationModel(this);
        qobject_cast<Kickoff::ApplicationModel*>(d->model)->init();
    }
    d->searchModel = new Kickoff::SearchModel();
    d->favoritesModel = new Kickoff::FavoritesModel(this);

    d->view = new RaptorGraphicsView(this);//Initialize the view as first element, some depend on it
    d->view->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding);
    d->view->setModel(d->model);

//     d->view = new RaptorItemsView();
//     RaptorItemDelegate *delegate = new RaptorItemDelegate();

    d->breadCrumb = new Breadcrumb(d->view, this);
    d->searchLine = new Plasma::LineEdit(this);
    d->favoritesIcon = new Plasma::IconWidget(this);
    d->favoritesIcon->setSizePolicy(QSizePolicy::Maximum, QSizePolicy::Maximum);
    d->favoritesIcon->setIcon(KIcon("rating"));
    //d->searchLine->setSizePolicy(QSizePolicy::Maximum, QSizePolicy::Maximum);

    d->appletConfig = appletconfig;

    QGraphicsLinearLayout *verticalLayout = new QGraphicsLinearLayout(Qt::Vertical);

    QGraphicsLinearLayout *horizontalLayout = new QGraphicsLinearLayout();
    horizontalLayout->addItem(d->breadCrumb);
    horizontalLayout->addStretch();
    horizontalLayout->addItem(d->favoritesIcon);
    horizontalLayout->addItem(d->searchLine);
    
    horizontalLayout->setMaximumHeight(Plasma::Theme::defaultTheme()->fontMetrics().height() + 2 * 2);//Set height to font height + some more spaces

    verticalLayout->addItem(horizontalLayout);
    QGraphicsLinearLayout *layout = new QGraphicsLinearLayout();
    layout->setOrientation(Qt::Horizontal);

    layout->addItem(d->view);

    verticalLayout->addItem(layout);

    setLayout(verticalLayout);
// 
//     delegate->setTextColor(Plasma::Theme::defaultTheme()->color(Plasma::Theme::TextColor));
// 
//     // let's make the view nicer in the applet
//     d->view->setAttribute(Qt::WA_NoSystemBackground);
//     d->view->viewport()->setAutoFillBackground(true);
//     QPalette p = d->view->viewport()->palette();
//     p.setColor(QPalette::Base, Qt::transparent);
//     d->view->viewport()->setPalette(p);
// 
//     d->view->setModel(d->model);
//     d->view->setItemDelegate(delegate);
// 
//     d->view->hideScrollBars();
// 

    KConfigGroup config(&d->appletConfig, "PlasmaRunnerManager");
    KConfigGroup conf(&config, "Plugins");

    conf.writeEntry("servicesEnabled", true);

    KService::List offers = KServiceTypeTrader::self()->query("Plasma/Runner");

    foreach (const KService::Ptr &service, offers) {
        KPluginInfo description(service);
        QString runnerName = description.pluginName();

        if (runnerName != "services")
        {
            conf.writeEntry(QString(runnerName + "Enabled"), false);
        }
    }
Пример #17
0
void UserWidget::buildDialog()
{
    updateColors();

    int m = 64; // size of the image
    int actionSize = KIconLoader::SizeSmallMedium;

    m_layout = new QGraphicsGridLayout(this);
    m_layout->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding);
    m_layout->setColumnFixedWidth(0, m); // This could probably be a bit more dynamic
    m_layout->setColumnMinimumWidth(1, 60);
    m_layout->setHorizontalSpacing(4);

    m_image = new ContactImage(m_engine, this);

    m_image->setPreferredWidth(m);
    m_image->setPreferredHeight(m);
    m_image->setMinimumHeight(m);
    m_image->setMinimumWidth(m);
    m_layout->addItem(m_image, 0, 0, 1, 1, Qt::AlignTop);

    m_nameLabel = new Label(this);
    m_nameLabel->nativeWidget()->setWordWrap(true);
    m_nameLabel->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Fixed);
    m_nameLabel->setMinimumWidth(60);
    m_nameLabel->setMaximumHeight(40);
    m_layout->addItem(m_nameLabel, 0, 1, 1, 1, Qt::AlignTop);


    m_infoView = new WebView(this);
    m_infoView->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding);
    //m_infoView->nativeWidget()->setFont(KGlobalSettings::smallestReadableFont());
    //m_infoView->nativeWidget()->setWordWrap(true);

    m_layout->addItem(m_infoView, 1, 0, 1, 2, Qt::AlignTop);

    Plasma::IconWidget* back = new Plasma::IconWidget;
    back->setIcon("go-previous-view");
    back->setToolTip(i18n("Back"));
    back->setMinimumHeight(actionSize);
    back->setMaximumHeight(actionSize);
    back->setMinimumWidth(actionSize);
    back->setMaximumWidth(actionSize);

    m_addFriend = new Plasma::IconWidget;
    m_addFriend->setIcon("list-add-user");
    m_addFriend->setToolTip(i18n("Add friend"));
    m_addFriend->setMinimumHeight(actionSize);
    m_addFriend->setMaximumHeight(actionSize);
    m_addFriend->setMinimumWidth(actionSize);
    m_addFriend->setMaximumWidth(actionSize);

    m_sendMessage = new Plasma::IconWidget;
    m_sendMessage->setIcon("mail-send");
    m_sendMessage->setToolTip(i18n("Send message"));
    m_sendMessage->setMinimumHeight(actionSize);
    m_sendMessage->setMaximumHeight(actionSize);
    m_sendMessage->setMinimumWidth(actionSize);
    m_sendMessage->setMaximumWidth(actionSize);

    QGraphicsLinearLayout* actionLayout = new QGraphicsLinearLayout(Qt::Horizontal);
    actionLayout->addItem(back);
    actionLayout->addStretch();
    actionLayout->addItem(m_addFriend);
    actionLayout->addItem(m_sendMessage);

    m_layout->addItem(actionLayout, 2, 0, 1, 2);
    setLayout(m_layout);

    m_mapper = new QSignalMapper(this);

    connect(back, SIGNAL(clicked()), SIGNAL(done()));
    connect(m_sendMessage, SIGNAL(clicked()), m_mapper, SLOT(map()));
    connect(m_addFriend, SIGNAL(clicked()), m_mapper, SLOT(map()));

    connect(m_mapper, SIGNAL(mapped(QString)),
            this, SIGNAL(sendMessage(QString)));

    updateColors();

    connect(&m_personWatch, SIGNAL(updated()), SLOT(dataUpdated()));
}
SrvAuthFailDlgLauncher::SrvAuthFailDlgLauncher(int& argc, char* argv[])
    : HbApplication(argc, argv), mMainWindow(0), mMainView(0)
{
    mMainWindow = new HbMainWindow();
    mMainView = new HbView();
    mMainView->setTitle(tr("SrvAuthFailDlgLauncher"));

    QGraphicsLinearLayout *layout = new QGraphicsLinearLayout(Qt::Vertical);

    layout->addItem(new HbLabel(tr("Server host name:")));
    mHostName = new HbTextEdit(tr("some.host.com"));
    layout->addItem(mHostName);
    layout->addStretch();

    layout->addItem(new HbLabel(tr("Certificate file:")));
    mFilesList = new HbComboBox;
    mFilesList->setEditable(false);
    QDir dir(KTestCertDir);
    if (dir.exists()) {
        QFileInfoList list = dir.entryInfoList(QDir::Files);
        QListIterator<QFileInfo> iter(list);
        while (iter.hasNext()) {
            const QFileInfo &info(iter.next());
            mFilesList->addItem(info.fileName());
        }
    }
    layout->addItem(mFilesList);
    layout->addStretch();

    layout->addItem(new HbLabel(tr("Validation result:")));
    mValidationResult = new HbComboBox;
    QStringList validationResults;
    validationResults
	    << "EValidatedOK"
	    << "EChainHasNoRoot"
	    << "ESignatureInvalid"
	    << "EDateOutOfRange"
	    << "ENameIsExcluded"
	    << "ENameNotPermitted"
	    << "ENotCACert"
	    << "ECertificateRevoked"
	    << "EUnrecognizedCriticalExtension"
	    << "ENoBasicConstraintInCACert"
	    << "ENoAcceptablePolicy"
	    << "EPathTooLong"
	    << "ENegativePathLengthSpecified"
	    << "ENamesDontChain"
	    << "ERequiredPolicyNotFound"
	    << "EBadKeyUsage"
	    << "ERootCertNotSelfSigned"
	    << "ECriticalExtendedKeyUsage"
	    << "ECriticalCertPoliciesWithQualifiers"
	    << "ECriticalPolicyMapping"
	    << "ECriticalDeviceId"
	    << "ECriticalSid"
	    << "ECriticalVid"
	    << "ECriticalCapabilities";
    mValidationResult->addItems(validationResults);
    mValidationResult->setCurrentIndex(1);      // EChainHasNoRoot
    layout->addItem(mValidationResult);
    layout->addStretch();

    mCancelShortly = new HbCheckBox("Cancel after 10 seconds");
    layout->addItem(mCancelShortly);

    HbPushButton *button = 0;
    button = new HbPushButton("Launch dialog");
    connect(button, SIGNAL(clicked()), this, SLOT(activateDialog()));
    layout->addItem(button);

    button = new HbPushButton("Exit");
    connect(button, SIGNAL(clicked()), qApp, SLOT(quit()));
    layout->addItem(button);

    mMainView->setLayout(layout);
    mMainWindow->addView(mMainView);
    mMainWindow->show();
}
void MpFetcherTestAppView::createLayout()
{
    qDebug() <<  "MpFetcherTestAppView::createLayout";

    QGraphicsLinearLayout* layout = new QGraphicsLinearLayout(Qt::Vertical);

    if (layout)
    {
        QGraphicsLinearLayout *topLayout = new QGraphicsLinearLayout(Qt::Vertical);

        if (topLayout)
        {
            topLayout->addStretch(5);

            mResultEdit = new HbLineEdit;
            HbLabel* label = new HbLabel("Result:");
            if (mResultEdit && label)
            {
                topLayout->addItem(label);
                mResultEdit->setMaxRows(5);
                topLayout->addItem(mResultEdit);
            }

            mErrorCodeEdit = new HbLineEdit;
            label = new HbLabel("Error code:");
            if (mErrorCodeEdit && label)
            {
                topLayout->addItem(label);
                topLayout->addItem(mErrorCodeEdit);
            }

            mErrorEdit = new HbLineEdit;
            label = new HbLabel("Error description:");
            if (mErrorEdit && label)
            {
                topLayout->addItem(label);
                mErrorEdit->setMaxRows(5);
                topLayout->addItem(mErrorEdit);
            }

            layout->addItem(topLayout);
            layout->setStretchFactor(topLayout, 5);
        }

        QGraphicsLinearLayout *bottomLayout = new QGraphicsLinearLayout(Qt::Vertical);

        if (bottomLayout)
        {
            bottomLayout->addStretch();
            HbPushButton* button = new HbPushButton("Fetch song");
            if (button)
            {
                connect(button, SIGNAL(clicked()), SLOT(fetchSong()));
                bottomLayout->addItem(button);
            }
            
            QGraphicsLinearLayout *playLayout = new QGraphicsLinearLayout(Qt::Horizontal);
            HbPushButton* playButton = new HbPushButton("Play song");
            if (playButton)
            {
                connect(playButton, SIGNAL(clicked()), SLOT(viewSong()));
                playLayout->addItem(playButton);
            }
            HbPushButton* viewButton = new HbPushButton("Play song caged");
            if (viewButton)
            {
                connect(viewButton, SIGNAL(clicked()), SLOT(viewSongCaged()));
                playLayout->addItem(viewButton);
            }
            bottomLayout->addItem(playLayout);
            
            QGraphicsLinearLayout *hsLayout = new QGraphicsLinearLayout(Qt::Horizontal);
            HbPushButton* homeScreenButton = new HbPushButton("HS Widget MainView");
            if (homeScreenButton)
            {
                connect(homeScreenButton, SIGNAL(clicked()), SLOT(launchHomeScreen()));
                hsLayout->addItem(homeScreenButton);
            }
                     
            HbPushButton* homeScreenButtonNPV = new HbPushButton("HS Widget NowPlayingView");
            if (homeScreenButtonNPV)
            {
                connect(homeScreenButtonNPV, SIGNAL(clicked()), SLOT(launchHomeScreenNowPlaying()));
                hsLayout->addItem(homeScreenButtonNPV);
            }
            
            HbPushButton* homeScreenButtonNPVS = new HbPushButton("HS Widget NPV Shuffle");
            if (homeScreenButtonNPVS)
            {
                connect(homeScreenButtonNPVS, SIGNAL(clicked()), SLOT(launchHomeScreenNPShuffle()));
                hsLayout->addItem(homeScreenButtonNPVS);
            }
            bottomLayout->addItem(hsLayout);
            
            HbPushButton* NowPlayingButton = new HbPushButton("NPV File Activity");
            if (NowPlayingButton)
            {
                connect(NowPlayingButton, SIGNAL(clicked()), SLOT(playNPVSong()));
                bottomLayout->addItem(NowPlayingButton);
            }
            QGraphicsLinearLayout *goomLayout = new QGraphicsLinearLayout(Qt::Horizontal);
            HbPushButton* endButton = new HbPushButton("End MP");
            if (endButton)
            {
                connect(endButton, SIGNAL(clicked()), SLOT(endMP()));
                goomLayout->addItem(endButton);
            }
                     
            HbPushButton* killButton = new HbPushButton("Kill MP");
            if (killButton)
            {
                connect(killButton, SIGNAL(clicked()), SLOT(killMP()));
                goomLayout->addItem(killButton);
            }
            
            bottomLayout->addItem(goomLayout);
            
            layout->addItem(bottomLayout);
        }

        setLayout(layout); // Takes ownership of layout
    }
}
Пример #20
0
void WicdApplet::init()
{
    m_theme->resize(contentsRect().size());
    
    Plasma::ToolTipManager::self()->registerWidget(this);

    //load dataengine
    Plasma::DataEngine *engine = dataEngine("wicd");
    if (!engine->isValid()) {
        setFailedToLaunch(true, i18n("Unable to load the Wicd data engine."));
        return;
    }
    
    setupActions();
    
    //build the popup dialog
    QGraphicsWidget *appletDialog = new QGraphicsWidget(this);
    m_dialoglayout = new QGraphicsLinearLayout(Qt::Vertical);
    
    //Network list
    m_scrollWidget = new Plasma::ScrollWidget(appletDialog);
    m_scrollWidget->setHorizontalScrollBarPolicy(Qt::ScrollBarAlwaysOff);
    m_scrollWidget->setFlag(QGraphicsItem::ItemClipsChildrenToShape);
    m_scrollWidget->setMaximumHeight(400);

    m_networkView = new NetworkView(m_scrollWidget);
    m_scrollWidget->setWidget(m_networkView);

    m_busyWidget = new Plasma::BusyWidget(m_scrollWidget);
    m_busyWidget->hide();

    m_dialoglayout->addItem(m_scrollWidget);
    
    //Separator
    m_dialoglayout->addItem(new Plasma::Separator(appletDialog));
    
    //Bottom bar
    QGraphicsLinearLayout* bottombarLayout = new QGraphicsLinearLayout(Qt::Horizontal);
    
    m_messageBox = new Plasma::Label(appletDialog);
    m_messageBox->setWordWrap(false);
    bottombarLayout->addItem(m_messageBox);
    
    bottombarLayout->addStretch();
    
    m_abortButton = new Plasma::ToolButton(appletDialog);
    m_abortButton->setIcon(KIcon("dialog-cancel"));
    m_abortButton->nativeWidget()->setToolTip(i18n("Abort"));
    connect(m_abortButton, SIGNAL(clicked()), this, SLOT(cancelConnect()));
    bottombarLayout->addItem(m_abortButton);
    
    Plasma::ToolButton *reloadButton = new Plasma::ToolButton(appletDialog);
    reloadButton->nativeWidget()->setToolTip(i18n("Reload"));
    reloadButton->setAction(action("reload"));
    bottombarLayout->addItem(reloadButton);
    
    m_dialoglayout->addItem(bottombarLayout);
    
    appletDialog->setLayout(m_dialoglayout);
    setGraphicsWidget(appletDialog);

    setHasConfigurationInterface(true);
    
    // read config
    configChanged();

    connect(Plasma::Theme::defaultTheme(), SIGNAL(themeChanged()), SLOT(updateColors()));


    //prevent notification on startup
    m_status.State = 10;
    m_isScanning = false;
    //connect dataengine
    m_wicdService = engine->serviceForSource("");
    engine->connectSource("status", this);
    engine->connectSource("daemon", this);
}