void CLogisticMainWindow::setupToolBar(const bool &visible)
{
    if (!visible) return;

    setUnifiedTitleAndToolBarOnMac(true);

    actionBar = new QToolBar(tr("Действия"), this);
    actionBar->setAllowedAreas(Qt::TopToolBarArea | Qt::RightToolBarArea | Qt::BottomToolBarArea);
    CLogisticMainWindow::addToolBar(actionBar);

    QAction *m_nd = actionBar->addAction(QIcon(QString("data/picture/toolbar/new.png")), tr("Новый документ"));
    connect(m_nd, SIGNAL(triggered()), this, SLOT(slotNewDocument()));

    QAction *m_ne = actionBar->addAction(QIcon(QString("data/picture/toolbar/edit.png")), tr("Открыть документ"));
    connect(m_ne, SIGNAL(triggered()), this, SLOT(slotOpenDocument()));

    actionBar->addSeparator();

    QAction *m_refresh = actionBar->addAction(QIcon(QString("data/picture/toolbar/refresh.png")), tr("Обновить"));
    connect(m_refresh, SIGNAL(triggered()), this, SLOT(slotRefreshDocument()));

    QAction *m_print = actionBar->addAction(QIcon(QString("data/picture/toolbar/print.png")), tr("Печать"));
    connect(m_print, SIGNAL(triggered()), this, SLOT(slotPrintDocument()));

    actionBar->addSeparator();

    QAction *m_cut = actionBar->addAction(QIcon(QString("data/picture/toolbar/cut.png")), tr("Вырезать"));
    connect(m_cut, SIGNAL(triggered()), SLOT(slotCutDocument()));

    QAction *m_copy = actionBar->addAction(QIcon(QString("data/picture/toolbar/copy.png")), tr("Копировать"));
    connect(m_copy, SIGNAL(triggered()), this, SLOT(slotCopyDocument()));

    QAction *m_paste = actionBar->addAction(QIcon(QString("data/picture/toolbar/paste.png")), tr("Вставить"));
    connect(m_paste, SIGNAL(triggered()), SLOT(slotPasteDocument()));

    QAction *m_delete = actionBar->addAction(QIcon(QString("data/picture/toolbar/delete.png")), tr("Удалить"));
    connect(m_delete, SIGNAL(triggered()), this, SLOT(slotDeleteDocument()));

    actionBar->addSeparator();

    QAction *m_actualOrAll = actionBar->addAction(QIcon(QString("data/picture/toolbar/actual.png")), tr("Актуальные/Все"));
    connect(m_actualOrAll, SIGNAL(triggered()), SLOT(slotActualDocumentsView()));

    actionBar->addAction(QIcon(QString("data/picture/toolbar/treelist.png")), tr("Дерево/Список"));

    actionBar->setIconSize(QSize(__ICON__WIDTH, __ICON__HEIGHT));
}
Exemple #2
0
void Portal::initActions()
{
  fileQuit = actionCollection()->addAction( KStandardAction::Quit, this, SLOT(slotFileQuit() ) );
  editCut = actionCollection()->addAction( KStandardAction::Cut, this, SLOT(slotEditCut() ) );
  editCopy = actionCollection()->addAction( KStandardAction::Copy, this, SLOT(slotEditCopy() ) );
  editPaste = actionCollection()->addAction( KStandardAction::Paste, this, SLOT(slotEditPaste() ) );
  viewStatusBar = KStandardAction::showStatusbar(this, SLOT(slotViewStatusBar()), actionCollection());

  actionCollection()->addAction( KStandardAction::Preferences, this, SLOT( preferences() ) );

  actNewDocument = actionCollection()->addAction( "document_new", this, SLOT( slotNewDocument()) );
  actNewDocument->setText( i18n("Create Document") );
  actNewDocument->setShortcut( KStandardShortcut::shortcut(KStandardShortcut::New) );
  actNewDocument->setIcon( KIcon("document-new"));

  actCopyDocument = actionCollection()->addAction( "document_copy", this, SLOT( slotCopyDocument()) );
  actCopyDocument->setText( i18n("Copy Document"));
  actCopyDocument->setShortcut( KStandardShortcut::shortcut(KStandardShortcut::Copy) );
  actCopyDocument->setIcon( KIcon( "document-edit"));

  actFollowDocument = actionCollection()->addAction( "document_follow", this, SLOT( slotFollowUpDocument() ) );
  actFollowDocument->setText( i18n("Follow Document" ));
  actFollowDocument->setShortcut( KShortcut( Qt::CTRL + Qt::Key_F ));
  actFollowDocument->setIcon( KIcon( "document-edit"));

  actPrintDocument = actionCollection()->addAction( "document_print", this, SLOT( slotPrintDocument()) );
  actPrintDocument->setText( i18n("Print Document"));
  actPrintDocument->setShortcut( KStandardShortcut::shortcut(KStandardShortcut::Print) );
  actPrintDocument->setIcon( KIcon("document-print"));

  actOpenArchivedDocument = actionCollection()->addAction( "archived_open", this, SLOT( slotArchivedDocExecuted()) );
  actOpenArchivedDocument->setText( i18n("Open Archived Document"));
  actOpenArchivedDocument->setShortcut( KShortcut(Qt::CTRL + Qt::Key_A) );

  actViewDocument  = actionCollection()->addAction( "document_view", this, SLOT( slotViewDocument()));
  actViewDocument->setText(i18n("Show Document"));
  actViewDocument->setShortcut( KStandardShortcut::shortcut(KStandardShortcut::Reload) );
  actViewDocument->setIcon( KIcon("document-preview" ));

  actOpenDocument = actionCollection()->addAction( "document_open", this, SLOT( slotOpenDocument()) );
  actOpenDocument->setText( i18n("Edit Document"));
  actOpenDocument->setShortcut( KStandardShortcut::shortcut(KStandardShortcut::Open) );
  actOpenDocument->setIcon( KIcon("document-open" ));

  actMailDocument = actionCollection()->addAction( "document_mail", this, SLOT( slotMailDocument()) );
  actMailDocument->setText(i18n("&Mail Document"));
  actMailDocument->setShortcut( KShortcut(Qt::CTRL + Qt::Key_M ));
  actMailDocument->setIcon( KIcon("mail-forward"));

  actEditTemplates = actionCollection()->addAction( "edit_tag_templates", this, SLOT( slotEditTagTemplates() ) );
  actEditTemplates->setText("Edit Tag Templates");
  actEditTemplates->setShortcut( KShortcut( Qt::CTRL + Qt::Key_E ));

  KAction *reconfDb = actionCollection()->addAction( "reconfigure_db", this, SLOT( slotReconfigureDatabase() ) );
  reconfDb->setText("Redo Initial Setup...");
  reconfDb->setShortcut( KShortcut( Qt::CTRL + Qt::Key_R ));

  fileQuit->setStatusTip(i18n("Quits the application"));
  editCut->setStatusTip(i18n("Cuts the selected section and puts it to the clipboard"));
  editCopy->setStatusTip(i18n("Copies the selected section to the clipboard"));
  editPaste->setStatusTip(i18n("Pastes the clipboard contents to current position"));
  viewStatusBar->setStatusTip(i18n("Enables/disables the statusbar"));

  actNewDocument->setStatusTip( i18n( "Creates a new Document" ) );
  actPrintDocument->setStatusTip( i18n( "Print and archive this Document" ) );
  actCopyDocument->setStatusTip( i18n( "Creates a new document which is a copy of the selected document" ) );
  actFollowDocument->setStatusTip( i18n( "Create a followup document for the current document" ) );
  actOpenDocument->setStatusTip( i18n( "Opens the document for editing" ) );
  actViewDocument->setStatusTip( i18n( "Opens a read only view on the document." ) );
  actMailDocument->setStatusTip( i18n( "Send document per mail" ) );
  actEditTemplates->setStatusTip( i18n("Edit the available tag templates which can be assigned to document items.") );
  reconfDb->setStatusTip( i18n( "Configure the Database Kraft is working on." ) );

  actOpenArchivedDocument->setStatusTip( i18n( "Open a viewer on an archived document" ) );
  setStandardToolBarMenuEnabled( true );
  actOpenDocument->setEnabled( false );
  actViewDocument->setEnabled( false );
  actPrintDocument->setEnabled( false );
  actCopyDocument->setEnabled( false );
  actFollowDocument->setEnabled( false );
  actMailDocument->setEnabled( false );

  actOpenArchivedDocument->setEnabled( false );
  // use the absolute path to your kraftui.rc file for testing purpose in createGUI();
  QString prjPath = QString::fromUtf8(qgetenv("KRAFT_HOME"));
  if( !prjPath.isEmpty() ) {
      createGUI(QString("%1/src/kraftui.rc").arg(prjPath));
  } else {
      createGUI( "kraftui.rc");
  }

}
void CLogisticMainWindow::setupMenu(const bool &visible)
{
    if (!visible) return;

// Document
    QMenu *documentMenu = menuBar()->addMenu(tr("&Документ"));
    documentMenu->addAction(tr("Новый"), this, SLOT(slotNewDocument()), QKeySequence(Qt::Key_F3));
    documentMenu->addAction(tr("Открыть"), this, SLOT(slotOpenDocument()), QKeySequence(Qt::Key_F4));
    documentMenu->addSeparator();
    documentMenu->addAction(tr("Печать"), this, SLOT(slotPrintDocument()));
    documentMenu->addSeparator();
    documentMenu->addAction(tr("Переместить"), this, SLOT(slotCutDocument()), QKeySequence(Qt::Key_F6));
    documentMenu->addAction(tr("Копировать"), this, SLOT(slotCopyDocument()));
    documentMenu->addAction(tr("Вставить"),this, SLOT(slotPasteDocument()));
    documentMenu->addAction(tr("Удалить"), this, SLOT(slotDeleteDocument()), QKeySequence(Qt::Key_F8));
    documentMenu->addSeparator();
    documentMenu->addAction(tr("Найти..."), this, SLOT(slotSearchDocument()));
    documentMenu->addAction(tr("Найти следующий"), this, SLOT(slotSearchNextDocument()));
    documentMenu->addAction(tr("Найти предыдущий"), this, SLOT(slotSearchPrevDocument()));
    documentMenu->addSeparator();
    documentMenu->addAction(tr("Обновить"), this, SLOT(slotRefreshDocument()));
    documentMenu->addAction(tr("Стать владельцем"), this, SLOT(slotOwnerDocument()));
    documentMenu->addSeparator();
    documentMenu->addAction(tr("Выход"), this, SLOT(close()), QKeySequence(Qt::ALT | Qt::Key_F4));

// Folder
    QMenu *folderMenu = menuBar()->addMenu(tr("&Папка"));
    folderMenu->addAction(tr("Взаимоотношения"), this, SLOT(slotRelationsFolder()));
    folderMenu->addAction(tr("Календать"), this, SLOT(slotCalendarFolder()));
    folderMenu->addAction(tr("Напоминания"), this, SLOT(slotReminderFolder()));

// Dictionary
    QMenu *dictionaryMenu = menuBar()->addMenu(tr("Справочники"));
    dictionaryMenu->addAction(tr("Заказчики"), this, SLOT(slotCustomerDictionary()));
    dictionaryMenu->addAction(tr("Поставщики"), this, SLOT(slotSuppliersDictionary()));
    dictionaryMenu->addAction(tr("Производители"), this, SLOT(slotProdusersDictionary()));
    dictionaryMenu->addSeparator();
    dictionaryMenu->addAction(tr("Контакты"), this, SLOT(slotContactsDictionary()));
    dictionaryMenu->addAction(tr("Должности"), this, SLOT(slotPositionsDictionary()));
    dictionaryMenu->addSeparator();
    dictionaryMenu->addAction(tr("Типы задач"), this, SLOT(slotTaskTypesDictionary()));
    dictionaryMenu->addAction(tr("Типы контрагентов"), this, SLOT(slotContractorTypesDictionary()));
    dictionaryMenu->addAction(tr("Статусы"), this, SLOT(slotStatusDictionary()));
    dictionaryMenu->addAction(tr("Приоритеты"), this, SLOT(slotPrioritiesDictionary()));
    dictionaryMenu->addSeparator();
    dictionaryMenu->addAction(tr("Страны и города"), this, SLOT(slotCountryCityDictionary()));

// View
    QMenu *viewMenu = menuBar()->addMenu(tr("&Вид"));

    QAction *m_actual = viewMenu->addAction(tr("Актуальные документы"));
    connect(m_actual, SIGNAL(triggered()), SLOT(slotActualDocumentsView()));

    viewMenu->addAction(tr("Дерево документов"), this, SLOT(slotTreeDocumentsView()), QKeySequence(Qt::Key_F9));

// Window
    QMenu *windowMenu = menuBar()->addMenu(tr("&Окно"));

    QAction *close = windowMenu->addAction(tr("Закрыть"));
    connect(close, SIGNAL(triggered()), mdiArea, SLOT(closeActiveSubWindow()));

    QAction *closeAll = windowMenu->addAction(tr("Закрыть все"));
    connect(closeAll, SIGNAL(triggered()), mdiArea, SLOT(closeAllSubWindows()));

    windowMenu->addSeparator();

    QAction *m_tile = windowMenu->addAction(tr("Плитка"));
    connect(m_tile, SIGNAL(triggered()), mdiArea, SLOT(tileSubWindows()));

    QAction *m_cascade = windowMenu->addAction(tr("Каскад"));
    connect(m_cascade, SIGNAL(triggered()), mdiArea, SLOT(cascadeSubWindows()));

    windowMenu->addSeparator();

    QMenu *modeMenu = windowMenu->addMenu(tr("Режим отображения"));
    QAction *m_modeMdi = modeMenu->addAction(tr("Оконный"));
    connect(m_modeMdi, SIGNAL(triggered()), mdiArea, SLOT(tileSubWindows()));
    QAction *m_modeWindow = modeMenu->addAction(tr("Вкладки"));
    connect(m_modeWindow, SIGNAL(triggered()), mdiArea, SLOT(tileSubWindows()));

    windowMenu->addSeparator();

    QAction *next = windowMenu->addAction(tr("Следующее"));
    connect(next, SIGNAL(triggered()), mdiArea, SLOT(activateNextSubWindow()));

    QAction *previous = windowMenu->addAction(tr("Предыдущее"));
    connect(previous, SIGNAL(triggered()), mdiArea, SLOT(activatePreviousSubWindow()));
}