~ubuntu-branches/ubuntu/saucy/kvirc/saucy

« back to all changes in this revision

Viewing changes to src/modules/popupeditor/PopupEditorWindow.cpp

  • Committer: Package Import Robot
  • Author(s): Mark Purcell
  • Date: 2013-05-18 19:36:33 UTC
  • mfrom: (22.1.4 sid)
  • Revision ID: package-import@ubuntu.com-20130518193633-kuhzryg7jstqvxpr
Tags: 4:4.2.0-2
Upload to unstable 

Show diffs side-by-side

added added

removed removed

Lines of Context:
184
184
: QWidget(par)
185
185
{
186
186
        m_pLastSelectedItem = 0;
187
 
        m_pContextPopup = new KviTalPopupMenu(this);
 
187
    m_pContextPopup = new QMenu(this);
188
188
        m_pClipboard = 0;
189
189
        m_pTestPopup = 0;
190
190
 
371
371
 
372
372
        m_pContextPopup->clear();
373
373
 
374
 
        PopupTreeWidgetItem * parentMenu = 0;
 
374
        //PopupTreeWidgetItem * parentMenu = 0;
375
375
        bool bIsMenu = false;
376
376
 
377
377
        if(it)
378
378
        {
379
 
                parentMenu = (PopupTreeWidgetItem *) (((PopupTreeWidgetItem *)it)->parent());
 
379
                //parentMenu = (PopupTreeWidgetItem *) (((PopupTreeWidgetItem *)it)->parent());
380
380
                bIsMenu = ((PopupTreeWidgetItem *)it)->m_type == PopupTreeWidgetItem::Menu;
381
381
        }
382
382
 
383
 
        m_pContextPopup->insertItem(__tr2qs_ctx("New Separator Below","editor"),this,SLOT(contextNewSeparatorBelow()));
384
 
        m_pContextPopup->setItemEnabled(
385
 
        m_pContextPopup->insertItem(__tr2qs_ctx("New Separator Above","editor"),this,SLOT(contextNewSeparatorAbove())),it);
386
 
        m_pContextPopup->setItemEnabled(
387
 
        m_pContextPopup->insertItem(__tr2qs_ctx("New Separator Inside","editor"),this,SLOT(contextNewSeparatorInside())),it && bIsMenu);
388
 
 
389
 
        m_pContextPopup->insertSeparator();
390
 
 
391
 
        m_pContextPopup->insertItem(__tr2qs_ctx("New Label Below","editor"),this,SLOT(contextNewLabelBelow()));
392
 
        m_pContextPopup->setItemEnabled(
393
 
        m_pContextPopup->insertItem(__tr2qs_ctx("New Label Above","editor"),this,SLOT(contextNewLabelAbove())),it);
394
 
        m_pContextPopup->setItemEnabled(
395
 
        m_pContextPopup->insertItem(__tr2qs_ctx("New Label Inside","editor"),this,SLOT(contextNewLabelInside())),it && bIsMenu);
396
 
 
397
 
        m_pContextPopup->insertSeparator();
398
 
 
399
 
        m_pContextPopup->insertItem(__tr2qs_ctx("New Item Below","editor"),this,SLOT(contextNewItemBelow()));
400
 
        m_pContextPopup->setItemEnabled(
401
 
        m_pContextPopup->insertItem(__tr2qs_ctx("New Item Above","editor"),this,SLOT(contextNewItemAbove())),it);
402
 
        m_pContextPopup->setItemEnabled(
403
 
        m_pContextPopup->insertItem(__tr2qs_ctx("New Item Inside","editor"),this,SLOT(contextNewItemInside())),it && bIsMenu);
404
 
 
405
 
        m_pContextPopup->insertSeparator();
406
 
 
407
 
        m_pContextPopup->insertItem(__tr2qs_ctx("New Menu Below","editor"),this,SLOT(contextNewMenuBelow()));
408
 
        m_pContextPopup->setItemEnabled(
409
 
        m_pContextPopup->insertItem(__tr2qs_ctx("New Menu Above","editor"),this,SLOT(contextNewMenuAbove())),it);
410
 
        m_pContextPopup->setItemEnabled(
411
 
        m_pContextPopup->insertItem(__tr2qs_ctx("New Menu Inside","editor"),this,SLOT(contextNewMenuInside())),it && bIsMenu);
412
 
 
413
 
        m_pContextPopup->insertSeparator();
414
 
 
415
 
        m_pContextPopup->insertItem(__tr2qs_ctx("New External Menu Below","editor"),this,SLOT(contextNewExtMenuBelow()));
416
 
        m_pContextPopup->setItemEnabled(
417
 
        m_pContextPopup->insertItem(__tr2qs_ctx("New External Menu Above","editor"),this,SLOT(contextNewExtMenuAbove())),it);
418
 
        m_pContextPopup->setItemEnabled(
419
 
        m_pContextPopup->insertItem(__tr2qs_ctx("New External Menu Inside","editor"),this,SLOT(contextNewExtMenuInside())),it && bIsMenu);
420
 
 
421
 
        m_pContextPopup->insertSeparator();
422
 
 
423
 
        m_pContextPopup->setItemEnabled(
424
 
        m_pContextPopup->insertItem(
 
383
        m_pContextPopup->addAction(__tr2qs_ctx("New Separator Below","editor"),this,SLOT(contextNewSeparatorBelow()));
 
384
    m_pContextPopup->addAction(__tr2qs_ctx("New Separator Above","editor"),this,SLOT(contextNewSeparatorAbove()))
 
385
            ->setEnabled(it);
 
386
    m_pContextPopup->addAction(__tr2qs_ctx("New Separator Inside","editor"),this,SLOT(contextNewSeparatorInside()))
 
387
            ->setEnabled(it && bIsMenu);
 
388
 
 
389
    m_pContextPopup->addSeparator();
 
390
 
 
391
        m_pContextPopup->addAction(__tr2qs_ctx("New Label Below","editor"),this,SLOT(contextNewLabelBelow()));
 
392
    m_pContextPopup->addAction(__tr2qs_ctx("New Label Above","editor"),this,SLOT(contextNewLabelAbove()))
 
393
            ->setEnabled(it);
 
394
    m_pContextPopup->addAction(__tr2qs_ctx("New Label Inside","editor"),this,SLOT(contextNewLabelInside()))
 
395
            ->setEnabled(it && bIsMenu);
 
396
 
 
397
    m_pContextPopup->addSeparator();
 
398
 
 
399
        m_pContextPopup->addAction(__tr2qs_ctx("New Item Below","editor"),this,SLOT(contextNewItemBelow()));
 
400
    m_pContextPopup->addAction(__tr2qs_ctx("New Item Above","editor"),this,SLOT(contextNewItemAbove()))
 
401
            ->setEnabled(it);
 
402
    m_pContextPopup->addAction(__tr2qs_ctx("New Item Inside","editor"),this,SLOT(contextNewItemInside()))
 
403
            ->setEnabled(it && bIsMenu);
 
404
 
 
405
    m_pContextPopup->addSeparator();
 
406
 
 
407
        m_pContextPopup->addAction(__tr2qs_ctx("New Menu Below","editor"),this,SLOT(contextNewMenuBelow()));
 
408
    m_pContextPopup->addAction(__tr2qs_ctx("New Menu Above","editor"),this,SLOT(contextNewMenuAbove()))
 
409
            ->setEnabled(it);
 
410
    m_pContextPopup->addAction(__tr2qs_ctx("New Menu Inside","editor"),this,SLOT(contextNewMenuInside()))
 
411
            ->setEnabled(it && bIsMenu);
 
412
 
 
413
    m_pContextPopup->addSeparator();
 
414
 
 
415
        m_pContextPopup->addAction(__tr2qs_ctx("New External Menu Below","editor"),this,SLOT(contextNewExtMenuBelow()));
 
416
    m_pContextPopup->addAction(__tr2qs_ctx("New External Menu Above","editor"),this,SLOT(contextNewExtMenuAbove()))
 
417
            ->setEnabled(it);
 
418
    m_pContextPopup->addAction(__tr2qs_ctx("New External Menu Inside","editor"),this,SLOT(contextNewExtMenuInside()))
 
419
            ->setEnabled(it && bIsMenu);
 
420
 
 
421
    m_pContextPopup->addSeparator();
 
422
 
 
423
        m_pContextPopup->addAction(
425
424
                *(g_pIconManager->getSmallIcon(KviIconManager::Cut)),
426
425
                __tr2qs_ctx("Cu&t","editor"),
427
 
                this,SLOT(contextCut())),it);
428
 
        m_pContextPopup->setItemEnabled(
429
 
        m_pContextPopup->insertItem(
 
426
        this,SLOT(contextCut()))
 
427
            ->setEnabled(it);
 
428
        m_pContextPopup->addAction(
430
429
                *(g_pIconManager->getSmallIcon(KviIconManager::Copy)),
431
430
                __tr2qs_ctx("&Copy","editor"),
432
 
                this,SLOT(contextCopy())),it);
433
 
        m_pContextPopup->setItemEnabled(
434
 
        m_pContextPopup->insertItem(
435
 
                *(g_pIconManager->getSmallIcon(KviIconManager::Paste)),
436
 
                __tr2qs_ctx("&Paste Below","editor"),this,SLOT(contextPasteBelow())),
437
 
                m_pClipboard);
438
 
        m_pContextPopup->setItemEnabled(
439
 
        m_pContextPopup->insertItem(
440
 
                *(g_pIconManager->getSmallIcon(KviIconManager::Paste)),
441
 
                __tr2qs_ctx("Paste Above","editor"),this,SLOT(contextPasteAbove())),it && m_pClipboard);
442
 
        m_pContextPopup->setItemEnabled(
443
 
        m_pContextPopup->insertItem(
444
 
                *(g_pIconManager->getSmallIcon(KviIconManager::Paste)),
445
 
                __tr2qs_ctx("Paste Inside","editor"),this,SLOT(contextPasteInside())),it && bIsMenu && m_pClipboard);
 
431
        this,SLOT(contextCopy()))
 
432
            ->setEnabled(it);
 
433
        m_pContextPopup->addAction(
 
434
                *(g_pIconManager->getSmallIcon(KviIconManager::Paste)),
 
435
        __tr2qs_ctx("&Paste Below","editor"),this,SLOT(contextPasteBelow()))
 
436
            ->setEnabled(m_pClipboard);
 
437
        m_pContextPopup->addAction(
 
438
                *(g_pIconManager->getSmallIcon(KviIconManager::Paste)),
 
439
        __tr2qs_ctx("Paste Above","editor"),this,SLOT(contextPasteAbove()))
 
440
            ->setEnabled(it && m_pClipboard);
 
441
        m_pContextPopup->addAction(
 
442
                *(g_pIconManager->getSmallIcon(KviIconManager::Paste)),
 
443
        __tr2qs_ctx("Paste Inside","editor"),this,SLOT(contextPasteInside()))
 
444
            ->setEnabled(it && bIsMenu && m_pClipboard);
446
445
 
447
446
        bool bSeparatorInserted = false;
448
447
 
449
448
//      if(!findPrologue(parentMenu))
450
449
//      {
451
 
                m_pContextPopup->insertSeparator();
 
450
        m_pContextPopup->addSeparator();
452
451
                bSeparatorInserted = true;
453
 
                m_pContextPopup->insertItem(
 
452
                m_pContextPopup->addAction(
454
453
                                *(g_pIconManager->getSmallIcon(KviIconManager::Prologue)),
455
454
                                __tr2qs_ctx("New Menu Prologue","editor"),this,SLOT(contextNewPrologue()));
456
455
//      }
457
456
 
458
457
//      if(!findEpilogue(parentMenu))
459
458
//      {
460
 
                if(!bSeparatorInserted)m_pContextPopup->insertSeparator();
461
 
                m_pContextPopup->insertItem(
 
459
        if(!bSeparatorInserted)m_pContextPopup->addSeparator();
 
460
                m_pContextPopup->addAction(
462
461
                                *(g_pIconManager->getSmallIcon(KviIconManager::Epilogue)),
463
462
                                __tr2qs_ctx("New Menu Epilogue","editor"),this,SLOT(contextNewEpilogue()));
464
463
//      }
1053
1052
        m_bOneTimeSetupDone = false;
1054
1053
        m_pLastEditedItem = 0;
1055
1054
 
1056
 
        m_pContextPopup = new KviTalPopupMenu(this);
1057
 
        m_pEmptyContextPopup = new KviTalPopupMenu(this);
 
1055
    m_pContextPopup = new QMenu(this);
 
1056
    m_pEmptyContextPopup = new QMenu(this);
1058
1057
 
1059
1058
        spl->setStretchFactor (0,20);
1060
1059
        spl->setStretchFactor (1,80);
1142
1141
        {
1143
1142
                m_pContextPopup->clear();
1144
1143
 
1145
 
                m_pContextPopup->insertItem(
 
1144
                m_pContextPopup->addAction(
1146
1145
                        *(g_pIconManager->getSmallIcon(KviIconManager::Popup)),
1147
1146
                        __tr2qs_ctx("&New Popup","editor"),
1148
1147
                        this,SLOT(newPopup()));
1149
1148
 
1150
 
                m_pContextPopup->setItemEnabled(
1151
 
                m_pContextPopup->insertItem(
 
1149
                m_pContextPopup->addAction(
1152
1150
                        *(g_pIconManager->getSmallIcon(KviIconManager::Quit)),
1153
1151
                        __tr2qs_ctx("Re&move Popup","editor"),
1154
 
                        this,SLOT(removeCurrentPopup())),it);
 
1152
            this,SLOT(removeCurrentPopup()))
 
1153
                    ->setEnabled(it);
1155
1154
 
1156
 
                m_pContextPopup->setItemEnabled(
1157
 
                m_pContextPopup->insertItem(
 
1155
                m_pContextPopup->addAction(
1158
1156
                        *(g_pIconManager->getSmallIcon(KviIconManager::Folder)),
1159
1157
                        __tr2qs_ctx("&Export Popup To...","editor"),
1160
 
                        this,SLOT(exportCurrentPopup())),it);
 
1158
            this,SLOT(exportCurrentPopup()))
 
1159
                ->setEnabled(it);
1161
1160
 
1162
1161
                m_pContextPopup->popup(QCursor::pos());
1163
1162
        } else {
1164
1163
                m_pEmptyContextPopup->clear();
1165
1164
 
1166
 
                m_pEmptyContextPopup->insertItem(
 
1165
                m_pEmptyContextPopup->addAction(
1167
1166
                        *(g_pIconManager->getSmallIcon(KviIconManager::Popup)),
1168
1167
                        __tr2qs_ctx("&New Popup","editor"),
1169
1168
                        this,SLOT(newPopup()));
1368
1367
}
1369
1368
 
1370
1369
 
1371
 
PopupEditorWindow::PopupEditorWindow(KviMainWindow * lpFrm)
1372
 
: KviWindow(KviWindow::ScriptEditor,lpFrm,"popupeditor",0)
 
1370
PopupEditorWindow::PopupEditorWindow()
 
1371
: KviWindow(KviWindow::ScriptEditor,"popupeditor",0)
1373
1372
{
1374
1373
        g_pPopupEditorWindow = this;
1375
1374