KPlatoWork_MainWindow::KPlatoWork_MainWindow() : KParts::MainWindow() { kDebug(planworkDbg())<<this; m_part = new KPlatoWork::Part( this, this ); KStandardAction::quit(kapp, SLOT(quit()), actionCollection()); KStandardAction::open(this, SLOT(slotFileOpen()), actionCollection()); // KStandardAction::save(this, SLOT(slotFileSave()), actionCollection()); QAction *a = KStandardAction::undo(m_part->undoStack(), SLOT(undo()), actionCollection()); a->setEnabled( false ); connect( m_part->undoStack(), SIGNAL(canUndoChanged(bool)), a, SLOT(setEnabled(bool)) ); a = KStandardAction::redo(m_part->undoStack(), SLOT(redo()), actionCollection()); a->setEnabled( false ); connect( m_part->undoStack(), SIGNAL(canRedoChanged(bool)), a, SLOT(setEnabled(bool)) ); setupGUI( KXmlGuiWindow::Default, "planwork_mainwindow.rc" ); setCentralWidget( m_part->widget() ); createGUI( m_part ); connect( m_part, SIGNAL(captionChanged(QString,bool)), SLOT(setCaption(QString,bool)) ); }
void View::updateReadWrite( bool readwrite ) { kDebug(planworkDbg())<<m_readWrite<<"->"<<readwrite; m_readWrite = readwrite; // actionTaskProgress->setEnabled( readwrite ); emit sigUpdateReadWrite( readwrite ); }
//called from slotFileSave(), slotFileSaveAs(), queryClose(), slotEmailFile() bool KPlatoWork_MainWindow::saveDocument( bool saveas, bool silent ) { kDebug(planworkDbg())<<saveas<<silent; KPlatoWork::Part *doc = rootDocument(); if ( doc == 0 ) { return true; } return doc->saveWorkPackages( silent ); }
void View::slotPopupMenu( const QString& name, const QPoint & pos ) { Q_ASSERT( m_part->factory() ); if ( m_part->factory() == 0 ) { return; } QMenu *menu = ( ( QMenu* ) m_part->factory() ->container( name, m_part ) ); if ( menu == 0 ) { return; } QList<QAction*> lst; AbstractView *v = currentView(); if ( v ) { lst = v->contextActionList(); kDebug(planworkDbg())<<lst; if ( ! lst.isEmpty() ) { menu->addSeparator(); foreach ( QAction *a, lst ) { menu->addAction( a ); } }
KPlatoWork_MainWindow::~KPlatoWork_MainWindow() { kDebug(planworkDbg()); }
View::View( Part *part, QWidget *parent, KActionCollection *collection ) : QStackedWidget( parent ), m_part( part ), m_scheduleActionGroup( new QActionGroup( this ) ), m_manager( 0 ) { m_readWrite = part->isReadWrite(); kDebug(planworkDbg())<<m_readWrite; // Add sub views createViews(); // The menu items // ------ Edit actionRemoveSelectedPackages = new KAction(koIcon("edit-delete"), i18n("Remove Packages"), this); collection->addAction("package_remove_selected", actionRemoveSelectedPackages ); connect( actionRemoveSelectedPackages, SIGNAL(triggered(bool)), SLOT(slotRemoveSelectedPackages()) ); actionRemoveCurrentPackage = new KAction(koIcon("edit-delete"), i18n("Remove Package"), this); collection->addAction("package_remove_current", actionRemoveCurrentPackage ); connect( actionRemoveCurrentPackage, SIGNAL(triggered(bool)), SLOT(slotRemoveCurrentPackage()) ); actionViewList = new KAction(koIcon("view-list-tree"), i18n("List"), this); actionViewList->setToolTip( i18nc( "@info:tooltip", "Select task list" ) ); collection->addAction("view_list", actionViewList ); connect( actionViewList, SIGNAL(triggered(bool)), SLOT(slotViewList()) ); actionViewGantt = new KAction(koIcon("view-time-schedule"), i18n("Gantt"), this); actionViewGantt->setToolTip( i18nc( "@info:tooltip", "Select timeline" ) ); collection->addAction("view_gantt", actionViewGantt ); connect( actionViewGantt, SIGNAL(triggered(bool)), SLOT(slotViewGantt()) ); // actionTaskProgress = new KAction(koIcon("document-edit"), i18n("Progress..."), this); // collection->addAction("task_progress", actionTaskProgress ); // connect( actionTaskProgress, SIGNAL(triggered(bool)), SLOT(slotTaskProgress()) ); //------ Settings actionConfigure = new KAction(koIcon("configure"), i18n("Configure PlanWork..."), this); collection->addAction("configure", actionConfigure ); connect( actionConfigure, SIGNAL(triggered(bool)), SLOT(slotConfigure()) ); //------ Popups actionEditDocument = new KAction(koIcon("document-edit"), i18n("Edit..."), this); collection->addAction("edit_document", actionEditDocument ); connect( actionEditDocument, SIGNAL(triggered(bool)), SLOT(slotEditDocument()) ); actionViewDocument = new KAction(koIcon("document-preview"), i18nc( "@verb", "View..."), this); collection->addAction("view_document", actionViewDocument ); connect( actionViewDocument, SIGNAL(triggered(bool)), SLOT(slotViewDocument()) ); // FIXME remove UndoText::removeDocument() when string freeze is lifted actionRemoveDocument = new KAction(koIcon("list-remove"), UndoText::removeDocument().toString(), this); collection->addAction("remove_document", actionRemoveDocument ); connect( actionRemoveDocument, SIGNAL(triggered(bool)), SLOT(slotRemoveDocument()) ); actionSendPackage = new KAction(koIcon("mail-send"), i18n("Send Package..."), this); collection->addAction("edit_sendpackage", actionSendPackage ); connect( actionSendPackage, SIGNAL(triggered(bool)), SLOT(slotSendPackage()) ); actionPackageSettings = new KAction(koIcon("document-properties"), i18n("Package Settings..."), this); collection->addAction("edit_packagesettings", actionPackageSettings ); connect( actionPackageSettings, SIGNAL(triggered(bool)), SLOT(slotPackageSettings()) ); actionTaskCompletion = new KAction(koIcon("document-edit"), i18n("Edit Progress..."), this); collection->addAction("task_progress", actionTaskCompletion ); connect( actionTaskCompletion, SIGNAL(triggered(bool)), SLOT(slotTaskCompletion()) ); actionViewDescription = new KAction(/*koIcon("document_view"),*/ i18n("View Description..."), this); collection->addAction("task_description", actionViewDescription ); connect( actionViewDescription, SIGNAL(triggered(bool)), SLOT(slotTaskDescription()) ); updateReadWrite( m_readWrite ); //kDebug(planworkDbg())<<" end"; loadContext(); slotCurrentChanged( currentIndex() ); connect( this, SIGNAL(currentChanged(int)), SLOT(slotCurrentChanged(int)) ); slotSelectionChanged(); }
void View::slotViewGantt() { kDebug(planworkDbg()); setCurrentIndex( 1 ); }
void View::slotViewList() { kDebug(planworkDbg()); setCurrentIndex( 0 ); }