00001 #include "TaskSwitcher.h" 00002 00003 TaskSwitcher::TaskSwitcher(const QString& kind) : m_kind(kind) 00004 { 00005 qDebug("TaskSwitcher::TaskSwitcher()"); 00006 } 00007 00008 TaskSwitcher::~TaskSwitcher() 00009 { 00010 qDebug("TaskSwitcher::~TaskSwitcher()"); 00011 } 00012 00013 bool TaskSwitcher::onKeyPress(int /*keycode*/) 00014 { 00015 if(m_applist.isEmpty()){ 00016 /* get list */ 00017 const QList<QWSWindow>& list = qwsServer->clientWindows(); 00018 QWSWindow* w; 00019 for(QListIterator<QWSWindow> it(list); (w=it.current()); ++it){ 00020 if(w->isVisible()){ 00021 QString app = w->client()->identity(); 00022 qDebug("applist[%s]", app.latin1()); 00023 if(app != NULL && m_applist.contains(app) == false){ 00024 m_applist.append(app); 00025 } 00026 } 00027 } 00028 m_appit = m_applist.begin(); 00029 } 00030 if(m_applist.count() > 1){ 00031 /* switch next */ 00032 next(); 00033 if(*m_appit == "launcher"){ 00034 next(); 00035 } 00036 Global::execute(*m_appit); 00037 } else if(m_applist.count() == 1 00038 && *m_appit != "launcher"){ 00039 Global::execute(*m_appit); 00040 } else { 00041 qDebug("no applications"); 00042 } 00043 return(true); 00044 } 00045 00046 bool TaskSwitcher::onModRelease(int /*keycode*/) 00047 { 00048 m_applist.clear(); 00049 return(false); 00050 } 00051 00052 void TaskSwitcher::next() 00053 { 00054 ++m_appit; 00055 if(m_appit == m_applist.end()){ 00056 m_appit = m_applist.begin(); 00057 } 00058 }
1.4.2