TaskItemModel::TaskItemModel(TaskManager *taskManager, QObject *parent) : QAbstractItemModel(parent) , m_taskManager(taskManager) { connect(m_taskManager, SIGNAL(aboutToBeTaskInserted(TaskItem *, int, int)), this, SLOT(taskManager_aboutToBeTaskInserted(TaskItem *, int, int))); connect(m_taskManager, SIGNAL(taskInserted(TaskItem *, int, int)), this, SLOT(taskManager_taskInserted(TaskItem *, int, int))); connect(m_taskManager, SIGNAL(aboutToBeTaskRemoved(TaskItem *, int, int)), this, SLOT(taskManager_aboutToBeTaskRemoved(TaskItem *, int, int))); connect(m_taskManager, SIGNAL(taskRemoved()), this, SLOT(taskManager_taskRemoved())); connect(m_taskManager, SIGNAL(aboutToBeTaskMoved(TaskItem *, int, int, TaskItem *, int)), this, SLOT(taskManager_aboutToBeTaskMoved(TaskItem *, int, int, TaskItem *, int))); connect(m_taskManager, SIGNAL(taskMoved()), this, SLOT(taskManager_taskMoved())); connect(m_taskManager, SIGNAL(taskDataChanged(TaskItem *, int, int, bool, bool, bool, bool)), this, SLOT(taskManager_taskDataChanged(TaskItem *, int, int, bool, bool, bool, bool))); connect(m_taskManager, SIGNAL(stateChanged(TaskManager::State)), this, SLOT(taskManager_stateChanged(TaskManager::State))); }
void TaskManager::windowRemoved(WId w ) { _skiptaskbar_windows.remove( w ); // find task Task* t = findTask(w); if (!t) return; if (t->window() == w) { _tasks.removeRef(t); emit taskRemoved(t); if(t == _active) _active = 0; delete t; //kdDebug() << "TM: Task for WId " << w << " removed." << endl; } else { t->removeTransient( w ); //kdDebug() << "TM: Transient " << w << " for Task " << t->window() << " removed." << endl; } }
TaskWindow::TaskWindow(TaskHub *taskhub) : d(new TaskWindowPrivate) { d->m_defaultHandler = 0; d->m_model = new Internal::TaskModel(this); d->m_filter = new Internal::TaskFilterModel(d->m_model); d->m_listview = new Internal::TaskView; d->m_listview->setModel(d->m_filter); d->m_listview->setFrameStyle(QFrame::NoFrame); d->m_listview->setWindowTitle(tr("Issues")); d->m_listview->setSelectionMode(QAbstractItemView::SingleSelection); Internal::TaskDelegate *tld = new Internal::TaskDelegate(this); d->m_listview->setItemDelegate(tld); d->m_listview->setWindowIcon(QIcon(QLatin1String(Constants::ICON_WINDOW))); d->m_listview->setContextMenuPolicy(Qt::ActionsContextMenu); d->m_listview->setAttribute(Qt::WA_MacShowFocusRect, false); d->m_taskWindowContext = new Internal::TaskWindowContext(d->m_listview); d->m_taskHub = taskhub; Core::ICore::addContextObject(d->m_taskWindowContext); connect(d->m_listview->selectionModel(), SIGNAL(currentChanged(QModelIndex,QModelIndex)), tld, SLOT(currentChanged(QModelIndex,QModelIndex))); connect(d->m_listview, SIGNAL(activated(QModelIndex)), this, SLOT(triggerDefaultHandler(QModelIndex))); d->m_contextMenu = new QMenu(d->m_listview); connect(d->m_contextMenu, SIGNAL(triggered(QAction*)), this, SLOT(contextMenuEntryTriggered(QAction*))); d->m_listview->setContextMenuPolicy(Qt::CustomContextMenu); connect(d->m_listview, SIGNAL(customContextMenuRequested(QPoint)), this, SLOT(showContextMenu(QPoint))); d->m_filterWarningsButton = createFilterButton(d->m_model->taskTypeIcon(Task::Warning), tr("Show Warnings"), this, SLOT(setShowWarnings(bool))); d->m_categoriesButton = new QToolButton; d->m_categoriesButton->setIcon(QIcon(QLatin1String(Core::Constants::ICON_FILTER))); d->m_categoriesButton->setToolTip(tr("Filter by categories")); d->m_categoriesButton->setProperty("noArrow", true); d->m_categoriesButton->setAutoRaise(true); d->m_categoriesButton->setPopupMode(QToolButton::InstantPopup); d->m_categoriesMenu = new QMenu(d->m_categoriesButton); connect(d->m_categoriesMenu, SIGNAL(aboutToShow()), this, SLOT(updateCategoriesMenu())); connect(d->m_categoriesMenu, SIGNAL(triggered(QAction*)), this, SLOT(filterCategoryTriggered(QAction*))); d->m_categoriesButton->setMenu(d->m_categoriesMenu); connect(d->m_taskHub, SIGNAL(categoryAdded(Core::Id,QString,bool)), this, SLOT(addCategory(Core::Id,QString,bool))); connect(d->m_taskHub, SIGNAL(taskAdded(ProjectExplorer::Task)), this, SLOT(addTask(ProjectExplorer::Task))); connect(d->m_taskHub, SIGNAL(taskRemoved(ProjectExplorer::Task)), this, SLOT(removeTask(ProjectExplorer::Task))); connect(d->m_taskHub, SIGNAL(taskLineNumberUpdated(uint,int)), this, SLOT(updatedTaskLineNumber(uint,int))); connect(d->m_taskHub, SIGNAL(taskFileNameUpdated(uint,QString)), this, SLOT(updatedTaskFileName(uint,QString))); connect(d->m_taskHub, SIGNAL(tasksCleared(Core::Id)), this, SLOT(clearTasks(Core::Id))); connect(d->m_taskHub, SIGNAL(categoryVisibilityChanged(Core::Id,bool)), this, SLOT(setCategoryVisibility(Core::Id,bool))); connect(d->m_taskHub, SIGNAL(popupRequested(bool)), this, SLOT(popup(bool))); connect(d->m_taskHub, SIGNAL(showTask(uint)), this, SLOT(showTask(uint))); }