Пример #1
0
void CurvesDialog::contextMenuEvent(QContextMenuEvent *e)
{
  QPoint pos = available->viewport()->mapFromGlobal(QCursor::pos());
  QRect rect = available->visualItemRect(available->currentItem());
  if (rect.contains(pos))
  {
    QMenu contextMenu(this);
    QList<QListWidgetItem *> lst = available->selectedItems();
    if (lst.size() > 1)
      contextMenu.insertItem(tr("&Plot Selection"), this, SLOT(addCurves()));
    else if (lst.size() == 1)
      contextMenu.insertItem(tr("&Plot"), this, SLOT(addCurves()));
    contextMenu.exec(QCursor::pos());
  }

  pos = contents->viewport()->mapFromGlobal(QCursor::pos());
  rect = contents->visualItemRect(contents->currentItem());
  if (rect.contains(pos))
  {
    QMenu contextMenu(this);
    QList<QListWidgetItem *> lst = contents->selectedItems();
    if (lst.size() > 1)
      contextMenu.insertItem(tr("&Delete Selection"), this, SLOT(removeCurves()));
    else if (lst.size() == 1)
      contextMenu.insertItem(tr("&Delete Curve"), this, SLOT(removeCurves()));
    contextMenu.exec(QCursor::pos());
  }

  e->accept();
}
Пример #2
0
amaroK::TrayIcon::TrayIcon( QWidget *playerWidget )
        : KSystemTray( playerWidget )
        , EngineObserver( EngineController::instance() )
        , trackLength( 0 )
        , mergeLevel( -1 )
        , overlay( 0 )
        , blinkTimerID( 0 )
        , overlayVisible( false )
{
    KActionCollection* const ac = amaroK::actionCollection();

    setAcceptDrops( true );

    ac->action( "prev"        )->plug( contextMenu() );
    ac->action( "play_pause"  )->plug( contextMenu() );
    ac->action( "stop"        )->plug( contextMenu() );
    ac->action( "next"        )->plug( contextMenu() );

    //seems to be necessary
    KAction *quit = actionCollection()->action( "file_quit" );
    quit->disconnect();
    connect( quit, SIGNAL(activated()), kapp, SLOT(quit()) );

    baseIcon     = KSystemTray::loadIcon( "amarok" );
    playOverlay  = amaroK::loadOverlay( "play" );
    pauseOverlay = amaroK::loadOverlay( "pause" );
    overlayVisible = false;

    //paintIcon();
    setPixmap( baseIcon );
}
Пример #3
0
TrayIcon::TrayIcon(MainWindow* parent)
  : KStatusNotifierItem(parent)
{
    setObjectName( "Ktimetracker Tray" );
    // the timer that updates the "running" icon in the tray
    _taskActiveTimer = new QTimer(this);
    connect( _taskActiveTimer, SIGNAL( timeout() ), this,
                               SLOT( advanceClock()) );

    if (icons == 0)
    {
        icons = new QVector<QPixmap*>(8);
        for (int i=0; i<8; i++)
        {
            QPixmap *icon = new QPixmap();
        QString name;
        name.sprintf("active-icon-%d.xpm",i);
        *icon = UserIcon(name);
        icons->insert(i,icon);
        }
    }
    TimetrackerWidget *timetrackerWidget = static_cast< TimetrackerWidget * >( parent->centralWidget() );
    if ( timetrackerWidget )
    {
        KAction *action = timetrackerWidget->action( "configure_ktimetracker" );
        if ( action ) contextMenu()->addAction( action );
        action = timetrackerWidget->action( "stopAll" );
        if ( action ) contextMenu()->addAction( action );
    }
    resetClock();
    initToolTip();
}
Пример #4
0
Knazar::Knazar(KAboutData *aboutData)
    : KSystemTrayIcon("knazar")
{
    new KnazarAdaptor(this);
    QDBusConnection dbus = QDBusConnection::sessionBus();
    dbus.registerObject("/KNazar", this);

    aboutApplicationDialog = new KAboutApplicationDialog(aboutData);

    //Initialize actions
    actionAbout = new KAction(KIcon("help-about"), i18n("About KNazar"), this);
    actionProtect = new KAction(KIcon("flag-blue"), i18n("Protect"), this);
    actionRelease = new KAction(KIcon("flag-red"), i18n("Release"), this);

    // Connect actions
    connect(actionAbout, SIGNAL(triggered(bool)), aboutApplicationDialog, SLOT(show()));
    connect(actionProtect, SIGNAL(triggered(bool)), this, SLOT(protect_from_harmful_looks()));
    connect(actionRelease, SIGNAL(triggered(bool)), this, SLOT(release_the_protection()));

    // Add them to menu
    contextMenu()->addAction(actionProtect);
    contextMenu()->addAction(actionRelease);
    contextMenu()->addSeparator();
    contextMenu()->addAction(actionAbout);

    // Initialize variables
    protection_working = true;
    number_of_attacks = defated_attacks = 0;
    setToolTip(i18n("KNazar - No harmful look allowed!" ));
    normalIcon = icon();
    grayIcon.addPixmap(icon().pixmap(22, 22, QIcon::Disabled));
}
Пример #5
0
zoomWindow::zoomWindow(Image *image, Site *site, QMap<QString,Site*> *sites, QWidget *)
    : QDialog(0, Qt::Window), ui(new Ui::zoomWindow), m_site(site), timeout(300), m_loaded(0), oldsize(0), image(NULL), movie(NULL), m_program(qApp->arguments().at(0)), m_reply(NULL), m_finished(false), m_thread(false), m_data(QByteArray()), m_size(0), m_sites(sites), m_source(), m_th(NULL), m_fullScreen(NULL)
{
	ui->setupUi(this);
	setAttribute(Qt::WA_DeleteOnClose);

	QList<Favorite> favorites = loadFavorites();
	for (Favorite fav : favorites)
		m_favorites.append(fav.getName());
	m_viewItLater = loadViewItLater();
    m_ignore = loadIgnored();
	m_image = new Image(site, image->details(), image->page());
	connect(m_image, &Image::urlChanged, this, &zoomWindow::urlChanged);

	m_mustSave = 0;

	QSettings settings(savePath("settings.ini"), QSettings::IniFormat);
	restoreGeometry(settings.value("Zoom/geometry").toByteArray());
	ui->buttonPlus->setChecked(settings.value("Zoom/plus", false).toBool());

	QShortcut *escape = new QShortcut(QKeySequence(Qt::Key_Escape), this);
		connect(escape, SIGNAL(activated()), this, SLOT(close()));
	QShortcut *save = new QShortcut(QKeySequence::Save, this);
		connect(save, SIGNAL(activated()), this, SLOT(saveImage()));
	QShortcut *saveAs = new QShortcut(QKeySequence("Ctrl+Shift+S"), this);
		connect(saveAs, SIGNAL(activated()), this, SLOT(saveImageAs()));

	m_labelTagsLeft = new QAffiche(QVariant(), 0, QColor(), this);
		m_labelTagsLeft->setContextMenuPolicy(Qt::CustomContextMenu);
		m_labelTagsLeft->setTextInteractionFlags(Qt::TextBrowserInteraction);
		connect(m_labelTagsLeft, SIGNAL(customContextMenuRequested(QPoint)), this, SLOT(contextMenu(QPoint)));
		connect(m_labelTagsLeft, SIGNAL(linkActivated(QString)), this, SLOT(openUrl(QString)));
		connect(m_labelTagsLeft, SIGNAL(linkHovered(QString)), this, SLOT(linkHovered(QString)));
		connect(m_labelTagsLeft, SIGNAL(middleClicked()), this, SLOT(openInNewTab()));
		ui->scrollAreaWidgetContents->layout()->addWidget(m_labelTagsLeft);

	m_labelTagsTop = new QAffiche(QVariant(), 0, QColor(), this);
		m_labelTagsTop->setWordWrap(true);
		m_labelTagsTop->setContextMenuPolicy(Qt::CustomContextMenu);
		m_labelTagsTop->setTextInteractionFlags(Qt::TextBrowserInteraction);
		connect(m_labelTagsTop, SIGNAL(customContextMenuRequested(QPoint)), this, SLOT(contextMenu(QPoint)));
		connect(m_labelTagsTop, SIGNAL(linkActivated(QString)), this, SLOT(openUrl(QString)));
		connect(m_labelTagsTop, SIGNAL(linkHovered(QString)), this, SLOT(linkHovered(QString)));
		connect(m_labelTagsTop, SIGNAL(middleClicked()), this, SLOT(openInNewTab()));
		ui->verticalLayout->insertWidget(0, m_labelTagsTop, 0);

	m_imageTime = NULL;
	go();
}
Пример #6
0
KXNeurTray::KXNeurTray()
 : KSystemTray()
{
    QPixmap pic;
    actions = new KActionCollection(this);
    menu = contextMenu();
    KApplication *app = KApplication::kApplication();

    // languages set in KXNeurApp::refresh_lang()
    menu->insertSeparator();

    mode = new KAction(i18n("Set manual mode"), "embedjs", 0, app, SLOT(slotUpdateMode()), actions);
    mode->plug(menu);
    run = new KAction(i18n("Stop xneur daemon"), "stop", 0, app, SLOT(slotUpdateRun()), actions);
    run->plug(menu);

    menu->insertSeparator();
    KAction *pref = KStdAction::preferences(app, SLOT(slotPref()), actions);
    pref->plug(menu);
    KAction *help = KStdAction::help(this, SLOT(slotHelp()), actions);
    help->plug(menu);
    KAction *about = KStdAction::aboutApp(this, SLOT(slotAbout()), actions);
    about->plug(menu);

    QObject::connect(menu, SIGNAL(activated(int)), app, SLOT(setMenuLang(int)));

    pic = kapp->iconLoader()->loadIcon("keyboard_layout", KIcon::Small);
    menu->changeTitle(menu->idAt(0), pic, i18n("KXNeur"));
    setPixmap(pic);
}
Пример #7
0
void db_x509req::showContextMenu(QContextMenuEvent *e, const QModelIndex &index)
{
	QMenu *menu = new QMenu(mainwin);
	QMenu *subExport;
	currentIdx = index;

	pki_x509req *req = static_cast<pki_x509req*>(index.internalPointer());

	menu->addAction(tr("New Request"), this, SLOT(newItem()));
	menu->addAction(tr("Import"), this, SLOT(load()));
	if (index != QModelIndex()) {
		if (!req->getRefKey())
			menu->addAction(tr("Extract public Key"),
				this, SLOT(extractPubkey()));
		menu->addAction(tr("Rename"), this, SLOT(edit()));
		menu->addAction(tr("Show Details"), this, SLOT(showItem()));
		menu->addAction(tr("Sign"), this, SLOT(signReq()));
		subExport = menu->addMenu(tr("Export"));
		subExport->addAction(tr("Clipboard"), this,
					SLOT(pem2clipboard()));
		subExport->addAction(tr("File"), this, SLOT(store()));
		subExport->addAction(tr("Template"), this, SLOT(toTemplate()));
		subExport->addAction(tr("OpenSSL config"), this,
					SLOT(toOpenssl()));
		menu->addAction(tr("Delete"), this, SLOT(delete_ask()));

		subExport->setEnabled(!req->isSpki());
	}
	contextMenu(e, menu);
	currentIdx = QModelIndex();
	return;
}
void PerformanceCounterSelection::counterTree_contextMenu(const QPoint &pos)
{
  RDTreeWidgetItem *item = ui->counterTree->itemAt(pos);

  QMenu contextMenu(this);

  QAction expandAll(tr("&Expand All"), this);
  QAction collapseAll(tr("&Collapse All"), this);

  contextMenu.addAction(&expandAll);
  contextMenu.addAction(&collapseAll);

  expandAll.setIcon(Icons::arrow_out());
  collapseAll.setIcon(Icons::arrow_in());

  expandAll.setEnabled(item && item->childCount() > 0);
  collapseAll.setEnabled(item && item->childCount() > 0);

  QObject::connect(&expandAll, &QAction::triggered,
                   [this, item]() { ui->counterTree->expandAllItems(item); });

  QObject::connect(&collapseAll, &QAction::triggered,
                   [this, item]() { ui->counterTree->collapseAllItems(item); });

  RDDialog::show(&contextMenu, ui->counterTree->viewport()->mapToGlobal(pos));
}
Пример #9
0
DockWidget::DockWidget(QWidget *parent, const char *name, PPPStats *st)
  : KSystemTrayIcon(parent), stats(st) {

  setObjectName(name);

  // load pixmaps
  dock_none_pixmap = UserIcon("dock_none");
  dock_left_pixmap = UserIcon("dock_left");
  dock_right_pixmap = UserIcon("dock_right");
  dock_both_pixmap = UserIcon("dock_both");

  setIcon(dock_none_pixmap);

  // popup menu for right mouse button
  popup_m = contextMenu();
  popup_m->addAction(i18n("Details"), p_kppp, SLOT(showStats()));
  popup_m->addSeparator();
  popup_m->addAction(i18n("Disconnect"), p_kppp, SLOT(disconnect()));
  // TODO see if we can rather connect the quit action to the
  // main window's quit handling, bypassing KSystemTrayIcon::maybeQuit
  QAction *quit =
    actionCollection()->action(KStandardAction::name(KStandardAction::Quit));
  if (quit != 0)
    quit->setVisible(false);
  // connect to stats for little modem animation
  connect(stats, SIGNAL(statsChanged(int)), SLOT(paintIcon(int)));

  DockWidget::dock_widget = this;
}
Пример #10
0
void nineButtonSelector::contextMenuEvent( QContextMenuEvent * )
{
	captionMenu contextMenu( windowTitle() );
	contextMenu.addAction( embed::getIconPixmap( "help" ), tr( "&Help" ),
			       this, SLOT( displayHelp() ) );
	contextMenu.exec( QCursor::pos() );
}
Пример #11
0
bool SearchEnginePropertiesDialog::eventFilter(QObject *object, QEvent *event)
{
	if (event->type() == QEvent::ContextMenu)
	{
		QLineEdit *lineEdit(qobject_cast<QLineEdit*>(object));

		if (lineEdit)
		{
			m_currentLineEdit = lineEdit;

			QMenu *contextMenu(lineEdit->createStandardContextMenu());
			contextMenu->addSeparator();

			QMenu *placeholdersMenu(contextMenu->addMenu(tr("Placeholders")));
			placeholdersMenu->addAction(tr("Search Terms"))->setData(QLatin1String("searchTerms"));
			placeholdersMenu->addAction(tr("Language"))->setData(QLatin1String("language"));

			connect(placeholdersMenu, SIGNAL(triggered(QAction*)), this, SLOT(insertPlaceholder(QAction*)));

			contextMenu->exec(static_cast<QContextMenuEvent*>(event)->globalPos());
			contextMenu->deleteLater();

			m_currentLineEdit = nullptr;

			return true;
		}
	}
Пример #12
0
/** class Tray
  * Reimplmentation of the system tray class adding drag/drop
  * capabilities and the quit action.
  */
Tray::Tray(MainWindow * parent)
    : KSystemTrayIcon(parent),
      grayedIcon( 0 ),
      alternateIcon( 0 ),
      playOverlay( 0 ),
      m_downloading( false )
{
    baseIcon = new QPixmap( KSystemTrayIcon::loadIcon("kget").pixmap(22) );
    // 12x12 pixel overlay looks fine, amarok uses 10x10
    playOverlay = new QPixmap( SmallIcon( "media-playback-start", 12 ) );

    paintIcon();

    // add preferences action to the context menu
    QMenu * cm = contextMenu();
    cm->addAction( parent->actionCollection()->action("new_download") );
    cm->addAction( parent->actionCollection()->action("import_links") );
    cm->addSeparator();
    cm->addAction( parent->actionCollection()->action("start_all_download") );
    cm->addAction( parent->actionCollection()->action("stop_all_download") );
    cm->addSeparator();
    cm->addAction( parent->actionCollection()->action("konqueror_integration") );
    cm->addAction( parent->actionCollection()->action("show_drop_target") );
    cm->addAction( parent->actionCollection()->action("options_configure") );

    // add tooltip telling "I'm kget"
    setToolTip(i18n("KGet - Download Manager"));

    // connecting the "Exit" menu item to the quit() of our app
    connect( this, SIGNAL( quitSelected() ), kapp, SLOT(quit()));
    connect( this, SIGNAL( activated( QSystemTrayIcon::ActivationReason ) ),
                   SLOT( slotActivated( QSystemTrayIcon::ActivationReason ) ) );
}
Пример #13
0
knazar::knazar()
    : DCOPObject( "DCOPNazarIface" ), KSystemTray( 0, "knazar" )
{
	// Insert TrayIcon
	trayIcon = KSystemTray::loadIcon( "knazar" );
	setPixmap( trayIcon );

	// Initialize and Register KNazar DCOP Interface so any KDE program can make Nazar easily
	if ( !kapp->dcopClient()->isRegistered() )
	{
		kapp->dcopClient()->registerAs( "knazar" );
		kapp->dcopClient()->setDefaultObject( objId() );
	}


	// Build PopupMenu
	KPopupMenu* menu = contextMenu();

	( new KAction( i18n( "Protect" ), "ledgreen", 0, this, SLOT( protect_from_harmfull_looks() ), this ) )->plug( menu );
	( new KAction( i18n( "Release" ), "ledred", 0, this, SLOT( release_the_protection() ), this ) )->plug( menu );
	menu->insertSeparator();
	( new KAction( i18n( "About" ), "about", 0, this, SLOT( about() ), this ) )->plug( menu );

	// Initialize variables
	protection_working = true;
	number_of_attacks = defated_attacks = 0;
	QToolTip::add( this, i18n( "knazar - No Harmfull look allowed!" ));
}
Пример #14
0
/*! \brief show the context menu
 */
void XletSwitchBoard::contextMenuEvent(QContextMenuEvent *event)
{
    // check if there is a group under the cursor
    Group *group = getGroup(m_layout->getPosInGrid(event->pos()));

    QMenu contextMenu(this);
    QAction *action;
    if (group) {
        action = contextMenu.addAction(tr("Remove group %1").arg(group->name()),
                                       this, SLOT(removeGroup()));
        action->setProperty("group", QVariant::fromValue((void *)group));

        action = contextMenu.addAction(tr("Change color of group %1").arg(group->name()),
                                       this, SLOT(changeGroupColor()));
        action->setProperty("group", QVariant::fromValue((void *)group));

        action = contextMenu.addAction(tr("Rename group %1").arg(group->name()),
                                       this, SLOT(changeGroupName())); 
        action->setProperty("group", QVariant::fromValue((void *)group));
    }

    action = contextMenu.addAction(tr("Add Phone number entry"),
                                   this, SLOT(addPhoneNumberEntry()));
    action->setProperty("pos", m_layout->getPosInGrid(event->pos()));

    action = new QAction(tr("Draw the grid"), this);
    action->setCheckable(true);
    action->setChecked(m_drawGrid);
    connect(action, SIGNAL(toggled(bool)),
            this, SLOT(drawTheGrid(bool)));
    contextMenu.addAction(action);

    contextMenu.exec(event->globalPos());
}
Пример #15
0
void QueryResultsNode::contextMenu(const QModelIndexList &list, INodeView *view)
{
    typedef QSet<QueryResultItem::Holder>              ItemsSet;
    typedef QList<QueryResultItem::Holder>             ItemsList;
    typedef QMap<QueryResultItem::Holder, QModelIndex> ItemsIndexMap;

    ItemsSet set;
    ItemsList items;
    QueryResultItem::Holder item;
    ItemsIndexMap itemsIndex;
    ContextMenu contextMenu(m_container.container());

    for (ItemsList::size_type i = 0, size = list.size(); i < size; ++i)
        if ((item = static_cast<QueryResultItem *>(list.at(i).internalPointer())).as<QueryResultItem>()->isPath() && !set.contains(item))
        {
            set.insert(item);
            itemsIndex[item] = list.at(i);
            contextMenu.add(item, item.as<QueryResultPathItem>()->info());
        }

    items = set.toList();

    contextMenu.add(Default::GlobalActions::instance()->copyAction(), ContextMenu::GeneralSection);
    contextMenu.add(Default::GlobalActions::instance()->cutAction(), ContextMenu::GeneralSection);

    if (items.size() == 1 && items.at(0).as<QueryResultPathItem>()->info()->isDir())
        contextMenu.add(Default::GlobalActions::instance()->pasteIntoFolderAction(), ContextMenu::GeneralSection);

    contextMenu.add(Default::GlobalActions::instance()->propertiesAction(), ContextMenu::PropertiesSection);

    if (const Action *action = contextMenu.exec())
    {
        Action::FilesList files = contextMenu.files(action);

        if (action->isAsynchronous())
        {
            ::Tools::Memory::ScopedPointer<PerformActionTask> task;

            if (task = static_cast<const AsyncAction *>(action)->process(this, m_container.container(), files))
            {
                Union update;
                Snapshot::Files list(m_container.container());

                for (Action::FilesList::size_type i = 0, size = files.size(); i < size; ++i)
                {
                    item = files.at(i).first;

//                    item->lock(static_cast<const AsyncAction *>(action)->lockReason());
//                    update.add(itemsIndex.value(item));
                    list.add(item.as<QueryResultPathItem>()->info()->fileName(), item);
                }

//                addTask(task.take(), list);
//                updateFirstColumn(update);
            }
        }
        else
            static_cast<const SyncAction *>(action)->process(m_container.container(), files);
    }
}
Пример #16
0
void sampleTCOView::contextMenuEvent( QContextMenuEvent * _cme )
{
	QMenu contextMenu( this );
	if( fixedTCOs() == false )
	{
		contextMenu.addAction( embed::getIconPixmap( "cancel" ),
					tr( "Delete (middle mousebutton)" ),
						this, SLOT( remove() ) );
		contextMenu.addSeparator();
		contextMenu.addAction( embed::getIconPixmap( "edit_cut" ),
					tr( "Cut" ), this, SLOT( cut() ) );
	}
	contextMenu.addAction( embed::getIconPixmap( "edit_copy" ),
					tr( "Copy" ), m_tco, SLOT( copy() ) );
	contextMenu.addAction( embed::getIconPixmap( "edit_paste" ),
					tr( "Paste" ), m_tco, SLOT( paste() ) );
	contextMenu.addSeparator();
	contextMenu.addAction( embed::getIconPixmap( "muted" ),
				tr( "Mute/unmute (<Ctrl> + middle click)" ),
						m_tco, SLOT( toggleMute() ) );
	contextMenu.addAction( embed::getIconPixmap( "record" ),
				tr( "Set/clear record" ),
						m_tco, SLOT( toggleRecord() ) );
	constructContextMenu( &contextMenu );

	contextMenu.exec( QCursor::pos() );
}
Пример #17
0
void SystemTrayIconBase::showFlash(const TrayIconData &trayIconData, int millisecondsTimeoutHint){
    
    if(trayIconData.isNull()){
        return;
    }
    
    stop();
    
    this->m_currentData = trayIconData;
    

    
    iconQueue = trayIconData.getIconList();
    setIcon(trayIconData.getFirstIcon());
    setToolTip(trayIconData.getToolTip());
    
    
    connect(timer, SIGNAL(timeout()), this, SLOT(slotShowFlash()));
    timer->setInterval(millisecondsTimeoutHint);
    timer->start();
    
    QMenu *menu = trayIconData.getMenu();
    if (menu) {
        QMenu *trayMenu = contextMenu();
        if (!trayMenu) {
            setContextMenu(menu);
        } else {
            trayMenu->addMenu(menu);
        }
    }
    


    
}
Пример #18
0
void Menu::contextMenuEvent(QContextMenuEvent *event)
{
	if (m_role == BookmarksMenuRole)
	{
		QAction *action = actionAt(event->pos());

		if (action && action->isEnabled() && action->data().type() == QVariant::ModelIndex)
		{
			m_bookmark = dynamic_cast<BookmarksItem*>(BookmarksManager::getModel()->itemFromIndex(action->data().toModelIndex()));

			QMenu contextMenu(this);
			contextMenu.addAction(Utils::getIcon(QLatin1String("document-open")), tr("Open"), this, SLOT(openBookmark()));
			contextMenu.addAction(tr("Open in New Tab"), this, SLOT(openBookmark()))->setData(WindowsManager::NewTabOpen);
			contextMenu.addAction(tr("Open in New Background Tab"), this, SLOT(openBookmark()))->setData(static_cast<int>(WindowsManager::NewTabOpen | WindowsManager::BackgroundOpen));
			contextMenu.addSeparator();
			contextMenu.addAction(tr("Open in New Window"), this, SLOT(openBookmark()))->setData(WindowsManager::NewWindowOpen);
			contextMenu.addAction(tr("Open in New Background Window"), this, SLOT(openBookmark()))->setData(static_cast<int>(WindowsManager::NewWindowOpen | WindowsManager::BackgroundOpen));
			contextMenu.exec(event->globalPos());

			return;
		}
	}

	QMenu::contextMenuEvent(event);
}
Пример #19
0
JDMainWin::JDMainWin(const QString &name, const QString &jid, int acc, QWidget *p)
	: QDialog(p, Qt::Window)
	, model_(0)
	, commands_(0)
	, refreshInProgres_(false)
	, yourJid_(name)
{
	setAttribute(Qt::WA_DeleteOnClose);
	ui_.setupUi(this);

	setWindowTitle(tr("Jabber Disk - %1").arg(name));

	model_ = new JDModel(jid, this);
	ui_.lv_disk->setModel(model_);

	commands_ = new JDCommands(acc, jid, this);

	ui_.pb_send->setShortcut(QKeySequence("Ctrl+Return"));
	connect(commands_, SIGNAL(incomingMessage(QString,JDCommands::Command)), SLOT(incomingMessage(QString,JDCommands::Command)));
	connect(commands_, SIGNAL(outgoingMessage(QString)), SLOT(outgoingMessage(QString)));
	connect(ui_.pb_refresh, SIGNAL(clicked()), SLOT(refresh()));
	connect(ui_.pb_send, SIGNAL(clicked()), SLOT(doSend()));
	connect(ui_.pb_clear, SIGNAL(clicked()), SLOT(clearLog()));

	connect(ui_.lv_disk, SIGNAL(newIndex(QModelIndex)), SLOT(indexChanged(QModelIndex)));
	connect(ui_.lv_disk, SIGNAL(contextMenu(QModelIndex)), SLOT(indexContextMenu(QModelIndex)));

	connect(model_, SIGNAL(moveItem(QString,QString)), SLOT(moveItem(QString,QString)));

	show();

	QTimer::singleShot(0, this, SLOT(refresh()));
}
Пример #20
0
void TabBar::mousePressEvent(QMouseEvent* ev)
{
    if (d->tabs.count() == 0) {
        update();
        return;
    }

    d->layoutTabs();

    QPoint pos = ev->pos();
    if (!isRightToLeft()) pos = pos - QPoint(d->offset, 0);

    int tab = d->tabAt(pos) + 1;
    if ((tab > 0) && (tab != d->activeTab)) {
        d->activeTab = tab;
        update();

        emit tabChanged(d->tabs[ d->activeTab-1]);

        // scroll if partially visible
        if (d->tabRects[ tab-1 ].right() > width() - d->offset)
            scrollForward();
    }

    if (ev->button() == Qt::RightButton)
        if (!d->readOnly)
            emit contextMenu(ev->globalPos());
}
Пример #21
0
void Cutegram::init_systray()
{
    if( p->desktop->desktopSession() == AsemanDesktopTools::Unity || p->desktop->desktopSession() == AsemanDesktopTools::GnomeFallBack )
    {
        QFile::remove(UNITY_ICON_PATH(0));
        QFile::copy(SYSTRAY_ICON,UNITY_ICON_PATH(0));

        p->unityTray = new UnitySystemTray( QCoreApplication::applicationName(), UNITY_ICON_PATH(0) );
        if( !p->unityTray->pntr() )
            QGuiApplication::setQuitOnLastWindowClosed(true);

        p->unityTray->addMenu( tr("Show"), this, "active" );
        p->unityTray->addMenu( tr("Configure"), this, "configure" );
        p->unityTray->addMenu( tr("Contact"), this, "contact" );
        p->unityTray->addMenu( tr("About"), this, "about" );
        p->unityTray->addMenu( tr("About Aseman"), this, "aboutAseman" );
        p->unityTray->addMenu( tr("Quit"), this, "quit" );
    }
    if( !p->unityTray || !p->unityTray->pntr() )
    {
        p->sysTray = new QSystemTrayIcon( QIcon(SYSTRAY_ICON), this );
        p->sysTray->setContextMenu(contextMenu());
#if (QT_VERSION >= QT_VERSION_CHECK(5, 5, 0))
        p->sysTray->setToolTip(tr("Cutegram"));
#endif
#ifndef Q_OS_MAC
        p->sysTray->show();
#endif

        connect( p->sysTray, SIGNAL(activated(QSystemTrayIcon::ActivationReason)), SLOT(systray_action(QSystemTrayIcon::ActivationReason)) );
    }
}
Пример #22
0
Файл: tray.cpp Проект: KDE/kget
/** class Tray
  * Reimplementation of the KStatusNotifierItem class
  */
Tray::Tray(MainWindow * parent)
    : KStatusNotifierItem(parent)
{
    // set up the context menu
    KMenu * cm = contextMenu();
    cm->addAction( parent->actionCollection()->action("new_download") );
    cm->addAction( parent->actionCollection()->action("import_links") );
    cm->addSeparator();
    cm->addAction( parent->actionCollection()->action("start_all_download") );
    cm->addAction( parent->actionCollection()->action("stop_all_download") );
    cm->addSeparator();
    cm->addAction( parent->actionCollection()->action("konqueror_integration") );
    cm->addAction( parent->actionCollection()->action("options_configure") );

    // Set up basic tray parameters
    setCategory(ApplicationStatus);
    setIconByName("kget");
    setTitle(i18n("KGet"));
    setContextMenu(cm);
    setAssociatedWidget(parent);
    setToolTipIconByName("kget");
    setToolTipTitle(i18n("Download Manager"));
    // Not of much use atm, but maybe we want to set this later?
    // setToolTipSubTitle("[..]");

    // filter middle mouse clicks to ask scheduler to paste URL
    connect( this, SIGNAL(secondaryActivateRequested(QPoint)),
             this, SLOT(slotActivated()) );
}
Пример #23
0
void SystemTrayIconBase::showIcon(const TrayIconData &trayIconData) {
    
    
    if(!trayIconData.isNull()){
        return;
    }
    
    stop();
    
    this->m_currentData = trayIconData;  
    
    
    setIcon(trayIconData.getFirstIcon());
    setToolTip(trayIconData.getToolTip());
    
    
    QMenu *menu = trayIconData.getMenu();
    if (menu) {
        QMenu *trayMenu = contextMenu();
        if (!trayMenu) {
            setContextMenu(menu);
        } else {
            trayMenu->addMenu(menu);
        }
    }
    
     

    
}
Пример #24
0
void SystemTrayIconBase::showIcon(const QIcon &icon, const QString &toolTip, QMenu *menu) {
    

    this->m_currentData.setToolTip(toolTip);
    this->m_currentData.setMenu(menu);
    this->m_currentData.settrayIconType(TrayIconData::TRAYICON_Normal);
    this->m_currentData.setFirstIcon(icon);
    
    
    stop();
    
    setIcon(icon);
    setToolTip(toolTip);
    
   
    if (menu) {
        QMenu *trayMenu = contextMenu();
        if (!trayMenu) {
            setContextMenu(menu);
        } else {
            trayMenu->addMenu(menu);
        }
    }
    
    
    
}
Пример #25
0
void Fader::contextMenuEvent( QContextMenuEvent * _ev )
{
	CaptionMenu contextMenu( windowTitle() );
	addDefaultActions( &contextMenu );
	contextMenu.exec( QCursor::pos() );
	_ev->accept();
}
Пример #26
0
IButtonBar::IButtonBar(QObject *parent) :
    QObject(parent),
    flashtoggle(false),
    activewid(-1),
    actionTitle(&menu),
    actionClose(&menu)
{
    toolbar.setWindowTitle("Buttonbar");
    toolbar.setToolButtonStyle(Qt::ToolButtonTextBesideIcon);
    toolbar.setIconSize( QSize(16, 16) );
    toolbar.setContextMenuPolicy(Qt::CustomContextMenu);

    flasher.setInterval(500);
    connect(&flasher, SIGNAL(timeout()),
            this, SLOT(onFlasher()));

    connect(&toolbar, SIGNAL(customContextMenuRequested(QPoint)),
            this, SLOT(contextMenu(QPoint)));

    actionTitle.setDisabled(true);
    QFont titlefont = actionTitle.font();
    titlefont.setWeight(QFont::Bold);
    actionTitle.setFont(titlefont);
    actionClose.setText(tr("Close"));

    menu.addAction(&actionTitle);
    menu.addSeparator();
    menu.addAction(&actionClose);

    connect(&actionClose, SIGNAL(triggered()),
            this, SLOT(actionCloseTrigger()));

    flasher.start();
    ConnectSignals;
}
Пример #27
0
HTMLMenuElement* HTMLElement::assignedContextMenu() const
{
    if (HTMLMenuElement* menu = contextMenu())
        return menu;

    return parentElement() && parentElement()->isHTMLElement() ? toHTMLElement(parentElement())->assignedContextMenu() : nullptr;
}
Пример #28
0
void TrayIcon::makeContextMenu()
{
    if (contextMenu() == 0)
    {
        setContextMenu(new QMenu());
    }
    else
    {
        contextMenu()->clear();
    }

    QAction* settingsAction = contextMenu()->addAction("Settings...");
    connect(settingsAction, SIGNAL(triggered()), &settingsDialog, SLOT(exec()));
    QAction* exitAction = contextMenu()->addAction("Exit");
    connect(exitAction, SIGNAL(triggered()), this, SLOT(exitAutoSuspender()));
}
Пример #29
0
void CurvesDialog::contextMenuEvent(QContextMenuEvent *e)
{
	QPoint pos = available->viewport()->mapFromGlobal(QCursor::pos());
	QRect rect = available->visualItemRect(available->currentItem());
	if (rect.contains(pos))
	{
       QList<QTreeWidgetItem *> lst = available->selectedItems();
       int count = 0;
	   foreach (QTreeWidgetItem *item, lst){
			if (item->type() == FolderItem)
				continue;

			count++;
	   }

	   if (!count)
		return;

	   QMenu contextMenu(this);
       if (count > 1)
	       contextMenu.insertItem(tr("&Plot Selection"), this, SLOT(addCurves()));
       else if (count == 1)
	       contextMenu.insertItem(tr("&Plot"), this, SLOT(addCurves()));
	   contextMenu.exec(QCursor::pos());
    }
Пример #30
0
//连续显示一组图标
//Show a group of icon
void SystemTrayIconBase::showAnimation(QList<QIcon> iconList,
                                       const QString &toolTip, QMenu *menu, int millisecondsTimeoutHint) {
    
    qDebug()<<"----SystemTrayIconBase::slotShowAnimation()";
    
    this->m_currentData.setToolTip(toolTip);
    this->m_currentData.setMenu(menu);
    this->m_currentData.settrayIconType(TrayIconData::TRAYICON_Animation);
    
    disconnect(timer, SIGNAL(timeout()), 0, 0);
    timer->stop();
    
    iconQueue.clear();
    iconQueue = iconList;
    setIcon(iconList.at(0));
    setToolTip(toolTip);
    
    
    connect(timer, SIGNAL(timeout()), this, SLOT(slotShowAnimation()));
    timer->setInterval(millisecondsTimeoutHint);
    timer->start();
    
    if (menu) {
        QMenu *trayMenu = contextMenu();
        if (!trayMenu) {
            setContextMenu(menu);
        } else {
            trayMenu->addMenu(menu);
        }
    }
    
    
}