Exemplo n.º 1
0
//
// Listview item popup menu callback
//
void DeviceManagerView::slotMenuCallBack(int item)
{
  switch (item)
    {
    case KMenuItemAdd:
      slotAdd();
      break;

    case KMenuItemRemove:
      slotRemove();
      break;

    case KMenuItemClone:
      slotClone();
      break;

    case KMenuItemProperties:
      slotProperties();
      break;

    case KMenuItemConsole:
      slotConsole();
      break;

    case KMenuItemMonitor:
      slotMonitor();
      break;

    default:
      break;
    }
}
Exemplo n.º 2
0
void K3bDataFileView::setupActions()
{
  m_actionCollection = new KActionCollection( this );

  m_actionProperties = new KAction( i18n("Properties"), "misc", 0, this, SLOT(slotProperties()),
				    actionCollection(), "properties" );
  m_actionNewDir = new KAction( i18n("New Directory..."), "folder_new", CTRL+Key_N, this, SLOT(slotNewDir()),
				actionCollection(), "new_dir" );
  m_actionRemove = new KAction( i18n("Remove"), "editdelete", Key_Delete, this, SLOT(slotRemoveItem()),
				actionCollection(), "remove" );
  KShortcut renameShortCut( Key_F2 );
  renameShortCut.append( KShortcut(CTRL+Key_R) ); // backwards compatibility
  m_actionRename = new KAction( i18n("Rename"), "edit", renameShortCut, this, SLOT(slotRenameItem()),
				actionCollection(), "rename" );
  m_actionParentDir = new KAction( i18n("Parent Directory"), "up", 0, this, SLOT(slotParentDir()),
				   actionCollection(), "parent_dir" );
  m_actionOpen = new KAction( i18n("Open"), "fileopen", 0, this, SLOT(slotOpen()),
				   actionCollection(), "open" );

  m_popupMenu = new KActionMenu( m_actionCollection, "contextMenu" );
  m_popupMenu->insert( m_actionParentDir );
  m_popupMenu->insert( new KActionSeparator( this ) );
  m_popupMenu->insert( m_actionRename );
  m_popupMenu->insert( m_actionRemove );
  m_popupMenu->insert( m_actionNewDir );
  m_popupMenu->insert( new KActionSeparator( this ) );
  m_popupMenu->insert( m_actionOpen );
  m_popupMenu->insert( new KActionSeparator( this ) );
  m_popupMenu->insert( m_actionProperties );
  m_popupMenu->insert( new KActionSeparator( this ) );
  m_popupMenu->insert( m_view->actionCollection()->action("project_burn") );
}
Exemplo n.º 3
0
void KonqSidebarTree::showToplevelContextMenu()
{
    KonqSidebarTreeTopLevelItem *item = 0;
    KonqSidebarTreeItem *treeItem = currentItem();
    if (treeItem && treeItem->isTopLevelItem())
        item = static_cast<KonqSidebarTreeTopLevelItem *>(treeItem);

    if (!m_collection)
    {
        m_collection = new KActionCollection( this, "bookmark actions" );
        (void) new KAction( i18n("&Create New Folder..."), "folder_new", 0, this,
                            SLOT( slotCreateFolder() ), m_collection, "create_folder");
        (void) new KAction( i18n("Delete Folder"), "editdelete", 0, this,
                            SLOT( slotDelete() ), m_collection, "delete_folder");
        (void) new KAction( i18n("Rename"), 0, this,
                            SLOT( slotRename() ), m_collection, "rename");
        (void) new KAction( i18n("Delete Link"), "editdelete", 0, this,
                            SLOT( slotDelete() ), m_collection, "delete_link");
        (void) new KAction( i18n("Properties"), "edit", 0, this,
                            SLOT( slotProperties() ), m_collection, "item_properties");
        (void) new KAction( i18n("Open in New Window"), "window_new", 0, this,
                            SLOT( slotOpenNewWindow() ), m_collection, "open_window");
        (void) new KAction( i18n("Open in New Tab"), "tab_new", 0, this,
                            SLOT( slotOpenTab() ), m_collection, "open_tab");
        (void) new KAction( i18n("Copy Link Address"), "editcopy", 0, this,
                            SLOT( slotCopyLocation() ), m_collection, "copy_location");
    }

    QPopupMenu *menu = new QPopupMenu;

    if (item) {
        if (item->isTopLevelGroup()) {
            m_collection->action("rename")->plug(menu);
            m_collection->action("delete_folder")->plug(menu);
            menu->insertSeparator();
            m_collection->action("create_folder")->plug(menu);
        } else {
            if (tabSupport())
                m_collection->action("open_tab")->plug(menu);
            m_collection->action("open_window")->plug(menu);
            m_collection->action("copy_location")->plug(menu);
            menu->insertSeparator();
            m_collection->action("rename")->plug(menu);
            m_collection->action("delete_link")->plug(menu);
        }
        menu->insertSeparator();
        m_collection->action("item_properties")->plug(menu);
    } else {
        m_collection->action("create_folder")->plug(menu);
    }

    m_currentTopLevelItem = item;

    menu->exec( QCursor::pos() );
    delete menu;

    m_currentTopLevelItem = 0;
}
Exemplo n.º 4
0
void K3bMovixView::showPropertiesDialog()
{
  K3bFileItem* dataItem = 0;

  // get selected item
  if( K3bMovixListViewItem* viewItem = dynamic_cast<K3bMovixListViewItem*>( m_listView->selectedItems().first() ) ) {
    dataItem = viewItem->fileItem();
  }

  if( dataItem ) {
    K3bDataPropertiesDialog d( dataItem, this );
    d.exec();
  }
  else
    slotProperties();
}
Exemplo n.º 5
0
void K3b::MovixView::showPropertiesDialog()
{
    const QModelIndexList selection = m_view->selectionModel()->selectedRows();

    if( selection.isEmpty() ) {
        // show project properties
        slotProperties();
    }
    else {
        QList<K3b::DataItem*> items;

        foreach(const QModelIndex &index, selection)
            items.append(m_model->itemForIndex(index));

        K3b::DataPropertiesDialog dlg( items, this );
        dlg.exec();
    }
}
Exemplo n.º 6
0
void KMMimePartTree::itemRightClicked( QListViewItem* item,
                                       const QPoint& point )
{
    // TODO: remove this member var?
    mCurrentContextMenuItem = dynamic_cast<KMMimePartTreeItem*>( item );
    if ( 0 == mCurrentContextMenuItem ) {
        kdDebug(5006) << "Item was not a KMMimePartTreeItem!" << endl;
    }
    else {
        kdDebug(5006) << "\n**\n** KMMimePartTree::itemRightClicked() **\n**" << endl;

        QPopupMenu* popup = new QPopupMenu;
        if ( mCurrentContextMenuItem->node()->nodeId() > 2 &&
             mCurrentContextMenuItem->node()->typeString() != "Multipart" ) {
          popup->insertItem( SmallIcon("fileopen"), i18n("to open", "Open"), this, SLOT(slotOpen()) );
          popup->insertItem( i18n("Open With..."), this, SLOT(slotOpenWith()) );
          popup->insertItem( i18n("to view something", "View"), this, SLOT(slotView()) );
        }
        popup->insertItem( SmallIcon("filesaveas"),i18n( "Save &As..." ), this, SLOT( slotSaveAs() ) );
        /*
         * FIXME mkae optional?
        popup->insertItem( i18n( "Save as &Encoded..." ), this,
                           SLOT( slotSaveAsEncoded() ) );
        */
        popup->insertItem( i18n( "Save All Attachments..." ), this,
                           SLOT( slotSaveAll() ) );
        // edit + delete only for attachments
        if ( mCurrentContextMenuItem->node()->nodeId() > 2 &&
             mCurrentContextMenuItem->node()->typeString() != "Multipart" ) {
          popup->insertItem( SmallIcon("editcopy"), i18n("Copy"), this, SLOT(slotCopy()) );
          if ( GlobalSettings::self()->allowAttachmentDeletion() )
            popup->insertItem( SmallIcon("editdelete"), i18n( "Delete Attachment" ),
                               this, SLOT( slotDelete() ) );
          if ( GlobalSettings::self()->allowAttachmentEditing() )
            popup->insertItem( SmallIcon( "edit" ), i18n( "Edit Attachment" ),
                               this, SLOT( slotEdit() ) );
        }
        if ( mCurrentContextMenuItem->node()->nodeId() > 0 )
          popup->insertItem( i18n("Properties"), this, SLOT(slotProperties()) );
        popup->exec( point );
        delete popup;
        mCurrentContextMenuItem = 0;
    }
}
Exemplo n.º 7
0
KonqSidebarBookmarkModule::KonqSidebarBookmarkModule( KonqSidebarTree * parentTree )
    : QObject( 0L ), KonqSidebarTreeModule( parentTree ),
      m_topLevelItem( 0L ), m_ignoreOpenChange(true)
{
    // formats handled by KBookmarkDrag:
    QStringList formats;
    formats << "text/uri-list" << "application/x-xbel" << "text/plain";
    tree()->setDropFormats(formats);

    connect(tree(), SIGNAL(moved(QListViewItem*,QListViewItem*,QListViewItem*)),
            this,   SLOT(slotMoved(QListViewItem*,QListViewItem*,QListViewItem*)));
    connect(tree(), SIGNAL(dropped(KListView*,QDropEvent*,QListViewItem*,QListViewItem*)),
            this,   SLOT(slotDropped(KListView*,QDropEvent*,QListViewItem*,QListViewItem*)));

    connect(tree(), SIGNAL(expanded(QListViewItem*)),
            this,   SLOT(slotOpenChange(QListViewItem*)));
    connect(tree(), SIGNAL(collapsed(QListViewItem*)),
            this,   SLOT(slotOpenChange(QListViewItem*)));

    m_collection = new KActionCollection( this, "bookmark actions" );
    (void) new KAction( i18n("&Create New Folder"), "folder_new", 0, this,
                        SLOT( slotCreateFolder() ), m_collection, "create_folder");
    (void) new KAction( i18n("Delete Folder"), "editdelete", 0, this,
                        SLOT( slotDelete() ), m_collection, "delete_folder");
    (void) new KAction( i18n("Delete Bookmark"), "editdelete", 0, this,
                        SLOT( slotDelete() ), m_collection, "delete_bookmark");
    (void) new KAction( i18n("Properties"), "edit", 0, this,
                        SLOT( slotProperties() ), m_collection, "item_properties");
    (void) new KAction( i18n("Open in New Window"), "window_new", 0, this,
                        SLOT( slotOpenNewWindow() ), m_collection, "open_window");
    (void) new KAction( i18n("Open in New Tab"), "tab_new", 0, this,
                        SLOT( slotOpenTab() ), m_collection, "open_tab");
    (void) new KAction( i18n("Open Folder in Tabs"), "tab_new", 0, this,
                        SLOT( slotOpenTab() ), m_collection, "folder_open_tabs");
    (void) new KAction( i18n("Copy Link Address"), "editcopy", 0, this,
                        SLOT( slotCopyLocation() ), m_collection, "copy_location");

    KStdAction::editBookmarks( KonqBookmarkManager::self(), SLOT( slotEditBookmarks() ),
			       m_collection, "edit_bookmarks" );

    connect( KonqBookmarkManager::self(), SIGNAL(changed(const QString &, const QString &) ),
             SLOT( slotBookmarksChanged(const QString &) ) );
}
Exemplo n.º 8
0
/**
 * Sets up the action buttons.
 * @param itemType      The item type.
 * @param parentLayout  The parent layout to which this group belongs.
 */
void ClassifierListPage::setupActionButtons(const QString& itemType, QVBoxLayout* parentLayout)
{
#if QT_VERSION >= 0x050000
    QDialogButtonBox* buttonBox = new QDialogButtonBox(m_pItemListGB);
    m_pNewClassifierListItemButton = buttonBox->addButton(itemType, QDialogButtonBox::ActionRole);
    connect(m_pNewClassifierListItemButton, SIGNAL(clicked()), this, SLOT(slotNewListItem()));
    m_pDeleteListItemButton = buttonBox->addButton(i18n("&Delete"), QDialogButtonBox::ActionRole);
    connect(m_pDeleteListItemButton, SIGNAL(clicked()), this, SLOT(slotDelete()));
    m_pPropertiesButton = buttonBox->addButton(i18n("&Properties"), QDialogButtonBox::ActionRole);
    connect(m_pPropertiesButton, SIGNAL(clicked()), this, SLOT(slotProperties()));
#else
    KDialogButtonBox* buttonBox = new KDialogButtonBox(m_pItemListGB);
    m_pNewClassifierListItemButton = buttonBox->addButton(itemType, KDialogButtonBox::ActionRole, this,
                          SLOT(slotNewListItem()));
    m_pDeleteListItemButton = buttonBox->addButton(i18n("&Delete"),
                              KDialogButtonBox::ActionRole, this, SLOT(slotDelete()));
    m_pPropertiesButton = buttonBox->addButton(i18n("&Properties"), KDialogButtonBox::ActionRole, this, SLOT(slotProperties()));
#endif
    parentLayout->addWidget(buttonBox);
}
Exemplo n.º 9
0
imageViewer::imageViewer(QWidget *parent): QLabel(parent)
{
  addToLog("image creation",LOGIMAG);
  validImage=false;
  setFrameStyle(QFrame::Sunken | QFrame::Panel);
  QBrush b;
  QPalette palette;
  b.setTexture(QPixmap::fromImage(QImage(":/icons/transparency.png")));
  palette.setBrush(QPalette::Active,QPalette::Base,b);
  palette.setBrush(QPalette::Inactive,QPalette::Base,b);
  palette.setBrush(QPalette::Disabled,QPalette::Base,b);
  setPalette(palette);
  setBackgroundRole(QPalette::Base);
  setSizePolicy(QSizePolicy::Ignored, QSizePolicy::Ignored);

  setBackgroundRole(QPalette::Dark);

  popup=new QMenu (this);
  newAct = new QAction(tr("&New"),this);
  connect(newAct, SIGNAL(triggered()), this, SLOT(slotNew()));
  loadAct = new QAction(tr("&Load"), this);
  connect(loadAct, SIGNAL(triggered()), this, SLOT(slotLoad()));
  toTXAct = new QAction(tr("&To TX"), this);
  connect(toTXAct, SIGNAL(triggered()), this, SLOT(slotToTX()));
  editAct = new QAction(tr("&Edit"), this);
  connect(editAct, SIGNAL(triggered()), this, SLOT(slotEdit()));
  printAct = new QAction(tr("&Print"), this);
  connect(printAct, SIGNAL(triggered()), this, SLOT(slotPrint()));
  deleteAct = new QAction(tr("&Delete"), this);
  connect(deleteAct, SIGNAL(triggered()), this, SLOT(slotDelete()));
  viewAct = new QAction(tr("&View"), this);
  connect(viewAct, SIGNAL(triggered()), this, SLOT(slotView()));
  propertiesAct = new QAction(tr("Propert&ies"), this);
  connect(propertiesAct, SIGNAL(triggered()), this, SLOT(slotProperties()));
  connect(configDialogPtr,SIGNAL(bgColorChanged()), SLOT(slotBGColorChanged()));

  init(RXIMG);
  activeMovie=false;
  //
}
Exemplo n.º 10
0
int FixtureManager::qt_metacall(QMetaObject::Call _c, int _id, void **_a)
{
    _id = QWidget::qt_metacall(_c, _id, _a);
    if (_id < 0)
        return _id;
    if (_c == QMetaObject::InvokeMetaMethod) {
        switch (_id) {
        case 0: slotFixtureAdded((*reinterpret_cast< quint32(*)>(_a[1]))); break;
        case 1: slotFixtureRemoved((*reinterpret_cast< quint32(*)>(_a[1]))); break;
        case 2: slotModeChanged((*reinterpret_cast< Doc::Mode(*)>(_a[1]))); break;
        case 3: slotSelectionChanged(); break;
        case 4: slotDoubleClicked((*reinterpret_cast< QTreeWidgetItem*(*)>(_a[1]))); break;
        case 5: slotAdd(); break;
        case 6: slotRemove(); break;
        case 7: slotProperties(); break;
        case 8: slotContextMenuRequested((*reinterpret_cast< const QPoint(*)>(_a[1]))); break;
        default: ;
        }
        _id -= 9;
    }
    return _id;
}
Exemplo n.º 11
0
//
// Clone a device
//
void DeviceManagerView::slotClone()
{
  QListViewItem* item = m_listView->currentItem();
  
  // Get the device id and name
  t_device_id old_id = item->text(KColumnID).toInt();
  
  DeviceClass* dc = _app->doc()->device(old_id)->deviceClass();
  assert(dc);
  
  QString new_name;
  new_name = item->text(KColumnName);
  new_name += "_new";
  
  // Add new device
  Device* d = _app->doc()->newDevice(dc, new_name, 0);
  assert(d);
  
  for (t_function_id id = 0; id < KFunctionArraySize; id++)
    {
      Function* f = _app->doc()->function(id);
      if (!f)
	{
	  continue;
	}
      
      //copy only functions that belong to parent device
      if (f->device() == old_id)
	{
	  copyFunction(f, d);
	}
    }
  
  QString newid;
  newid.setNum(d->id());
  m_listView->setCurrentItem(m_listView->findItem(newid, KColumnID));
  slotProperties();
}
Exemplo n.º 12
0
void FixtureManager::slotDoubleClicked(QTreeWidgetItem* item)
{
	if (item != NULL && _app->mode() != App::Operate)
		slotProperties();
}
Exemplo n.º 13
0
//
// Set up a toolbar
//
void DeviceManagerView::initToolBar()
{
  // Get the system directory to get to pixmaps
  QString dir;
  _app->settings()->get(KEY_SYSTEM_DIR, dir);
  dir += QString("/") + PIXMAPPATH;

  // Create a dock area for the toolbar
  m_dockArea = new QDockArea(Horizontal, QDockArea::Normal, this);
  m_dockArea->setSizePolicy(QSizePolicy::Minimum, QSizePolicy::Minimum);

  // Add the dock area to the top of the vertical layout
  m_layout->addWidget(m_dockArea);

  //
  // Add a toolbar to the dock area
  //
  m_toolbar = new QToolBar("Device Manager", _app, m_dockArea);

  m_addButton = 
    new QToolButton(QIconSet(QPixmap(dir + "/addoutputdevice.xpm")), 
		    "Add", 0, this,
		    SLOT(slotAdd()), m_toolbar);
  m_addButton->setUsesTextLabel(true);
  QToolTip::add( m_addButton,  "Add New Device");  
  
  m_cloneButton = 
    new QToolButton(QIconSet(QPixmap(dir + "/editcopy.xpm")), 
		    "Clone", 0, this,
		    SLOT(slotClone()), m_toolbar);
  m_cloneButton->setUsesTextLabel(true);
  QToolTip::add( m_cloneButton, "Clone a device and its functions" );
  
  m_removeButton =
    new QToolButton(QIconSet(QPixmap(dir + "/remove.xpm")),
		    "Remove", 0, this,
		    SLOT(slotRemove()), m_toolbar);
  m_removeButton->setUsesTextLabel(true);
  QToolTip::add( m_removeButton, "Remove Current Selection");
  
  m_propertiesButton = 
    new QToolButton(QIconSet(QPixmap(dir + "/settings.xpm")), 
		    "Properties", 0, this,
		    SLOT(slotProperties()), m_toolbar);
  m_propertiesButton->setUsesTextLabel(true);
  QToolTip::add( m_propertiesButton,   "Device properties"); 

  m_toolbar->addSeparator();

  m_monitorButton = 
    new QToolButton(QIconSet(QPixmap(dir + "/monitor.xpm")), 
		    "Monitor Device", 0, this,
		    SLOT(slotMonitor()), m_toolbar);
  m_monitorButton->setUsesTextLabel(true);
  QToolTip::add(m_monitorButton, "Monitor Device");

  m_consoleButton = 
    new QToolButton(QIconSet(QPixmap(dir + "/console.xpm")), 
		    "View Console", 0, this,
		    SLOT(slotConsole()), m_toolbar);
  m_consoleButton->setUsesTextLabel(true);
  QToolTip::add( m_consoleButton, "View Console");
}
Exemplo n.º 14
0
/**
 * Sets up the action buttons.
 * @param itemType      The item type.
 * @param parentLayout  The parent layout to which this group belongs.
 */
void ClassifierListPage::setupActionButtons(const QString& itemType, QVBoxLayout* parentLayout)
{
    KDialogButtonBox* buttonBox = new KDialogButtonBox(m_pItemListGB);
    m_pNewClassifierListItemButton = buttonBox->addButton( itemType, KDialogButtonBox::ActionRole, this,
                          SLOT(slotNewListItem()) );
    m_pDeleteListItemButton = buttonBox->addButton( i18n("&Delete"),
                              KDialogButtonBox::ActionRole, this, SLOT(slotDelete()) );
    m_pPropertiesButton = buttonBox->addButton( i18n("&Properties"), KDialogButtonBox::ActionRole, this,SLOT(slotProperties()) );
    parentLayout->addWidget(buttonBox);
}