Diffstat (limited to 'core/launcher/runningappbar.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r-- | core/launcher/runningappbar.cpp | 9 |
1 files changed, 0 insertions, 9 deletions
diff --git a/core/launcher/runningappbar.cpp b/core/launcher/runningappbar.cpp index 3ac66f2..356200b 100644 --- a/core/launcher/runningappbar.cpp +++ b/core/launcher/runningappbar.cpp | |||
@@ -79,105 +79,96 @@ void RunningAppBar::newQcopChannel(const QString& channelName) | |||
79 | void RunningAppBar::removedQcopChannel(const QString& channelName) | 79 | void RunningAppBar::removedQcopChannel(const QString& channelName) |
80 | { | 80 | { |
81 | QString prefix("QPE/Application/"); | 81 | QString prefix("QPE/Application/"); |
82 | if (channelName.startsWith(prefix)) { | 82 | if (channelName.startsWith(prefix)) { |
83 | QString appName = channelName.mid(prefix.length()); | 83 | QString appName = channelName.mid(prefix.length()); |
84 | qDebug("App %s just disconnected!", appName.latin1()); | 84 | qDebug("App %s just disconnected!", appName.latin1()); |
85 | const AppLnk* newGuy = m_AppLnkSet->findExec(appName); | 85 | const AppLnk* newGuy = m_AppLnkSet->findExec(appName); |
86 | if (newGuy) { | 86 | if (newGuy) { |
87 | removeTask(*newGuy); | 87 | removeTask(*newGuy); |
88 | } | 88 | } |
89 | } | 89 | } |
90 | } | 90 | } |
91 | 91 | ||
92 | void RunningAppBar::received(const QCString& msg, const QByteArray& data) | 92 | void RunningAppBar::received(const QCString& msg, const QByteArray& data) |
93 | { | 93 | { |
94 | // Since fast apps appear and disappear without disconnecting from their | 94 | // Since fast apps appear and disappear without disconnecting from their |
95 | // channel we need to watch for the showing/hiding events and update according. | 95 | // channel we need to watch for the showing/hiding events and update according. |
96 | QDataStream stream( data, IO_ReadOnly ); | 96 | QDataStream stream( data, IO_ReadOnly ); |
97 | if ( msg == "fastAppShowing(QString)") { | 97 | if ( msg == "fastAppShowing(QString)") { |
98 | QString appName; | 98 | QString appName; |
99 | stream >> appName; | 99 | stream >> appName; |
100 | addTask(*m_AppLnkSet->findExec(appName)); | 100 | addTask(*m_AppLnkSet->findExec(appName)); |
101 | } | 101 | } |
102 | else if ( msg == "fastAppHiding(QString)") { | 102 | else if ( msg == "fastAppHiding(QString)") { |
103 | QString appName; | 103 | QString appName; |
104 | stream >> appName; | 104 | stream >> appName; |
105 | removeTask(*m_AppLnkSet->findExec(appName)); | 105 | removeTask(*m_AppLnkSet->findExec(appName)); |
106 | } | 106 | } |
107 | } | 107 | } |
108 | 108 | ||
109 | void RunningAppBar::addTask(const AppLnk& appLnk) | 109 | void RunningAppBar::addTask(const AppLnk& appLnk) |
110 | { | 110 | { |
111 | // qDebug("Added %s to app list.", appLnk.name().latin1()); | 111 | // qDebug("Added %s to app list.", appLnk.name().latin1()); |
112 | AppLnk* newApp = new AppLnk(appLnk); | 112 | AppLnk* newApp = new AppLnk(appLnk); |
113 | newApp->setExec(appLnk.exec()); | 113 | newApp->setExec(appLnk.exec()); |
114 | m_AppList.prepend(newApp); | 114 | m_AppList.prepend(newApp); |
115 | update(); | 115 | update(); |
116 | } | 116 | } |
117 | 117 | ||
118 | void RunningAppBar::removeTask(const AppLnk& appLnk) | 118 | void RunningAppBar::removeTask(const AppLnk& appLnk) |
119 | { | 119 | { |
120 | unsigned int i = 0; | 120 | unsigned int i = 0; |
121 | for (; i < m_AppList.count() ; i++) { | 121 | for (; i < m_AppList.count() ; i++) { |
122 | AppLnk* target = m_AppList.at(i); | 122 | AppLnk* target = m_AppList.at(i); |
123 | if (target->exec() == appLnk.exec()) { | 123 | if (target->exec() == appLnk.exec()) { |
124 | qDebug("Removing %s from app list.", appLnk.name().latin1()); | 124 | qDebug("Removing %s from app list.", appLnk.name().latin1()); |
125 | m_AppList.remove(); | 125 | m_AppList.remove(); |
126 | 126 | ||
127 | // grab the keyboard back, in case the app crashed/forgot | ||
128 | |||
129 | QPEApplication *qpeapp = (QPEApplication *) qApp; | ||
130 | |||
131 | if ( appLnk.exec() == qpeapp-> keyboardGrabbedBy ( )) { | ||
132 | qDebug ( "grabbing keyboard back from %s", appLnk.name().latin1()); | ||
133 | qpeapp-> grabKeyboard ( ); | ||
134 | } | ||
135 | |||
136 | delete target; | 127 | delete target; |
137 | } | 128 | } |
138 | } | 129 | } |
139 | update(); | 130 | update(); |
140 | } | 131 | } |
141 | 132 | ||
142 | void RunningAppBar::mousePressEvent(QMouseEvent *e) | 133 | void RunningAppBar::mousePressEvent(QMouseEvent *e) |
143 | { | 134 | { |
144 | // Find out if the user is clicking on an app icon... | 135 | // Find out if the user is clicking on an app icon... |
145 | // If so, snag the index so when we repaint we show it | 136 | // If so, snag the index so when we repaint we show it |
146 | // as highlighed. | 137 | // as highlighed. |
147 | m_SelectedAppIndex = 0; | 138 | m_SelectedAppIndex = 0; |
148 | int x = 0; | 139 | int x = 0; |
149 | QListIterator<AppLnk> it( m_AppList ); | 140 | QListIterator<AppLnk> it( m_AppList ); |
150 | for ( ; it.current(); ++it, ++m_SelectedAppIndex, x += spacing ) { | 141 | for ( ; it.current(); ++it, ++m_SelectedAppIndex, x += spacing ) { |
151 | if ( x + spacing <= width() ) { | 142 | if ( x + spacing <= width() ) { |
152 | if ( e->x() >= x && e->x() < x + spacing ) { | 143 | if ( e->x() >= x && e->x() < x + spacing ) { |
153 | if ( m_SelectedAppIndex < (int)m_AppList.count() ) { | 144 | if ( m_SelectedAppIndex < (int)m_AppList.count() ) { |
154 | repaint(FALSE); | 145 | repaint(FALSE); |
155 | return ; | 146 | return ; |
156 | } | 147 | } |
157 | } | 148 | } |
158 | } | 149 | } |
159 | else { | 150 | else { |
160 | break; | 151 | break; |
161 | } | 152 | } |
162 | } | 153 | } |
163 | m_SelectedAppIndex = -1; | 154 | m_SelectedAppIndex = -1; |
164 | repaint( FALSE ); | 155 | repaint( FALSE ); |
165 | } | 156 | } |
166 | 157 | ||
167 | void RunningAppBar::mouseReleaseEvent(QMouseEvent *e) | 158 | void RunningAppBar::mouseReleaseEvent(QMouseEvent *e) |
168 | { | 159 | { |
169 | if (e->button() == QMouseEvent::RightButton) { | 160 | if (e->button() == QMouseEvent::RightButton) { |
170 | return ; | 161 | return ; |
171 | } | 162 | } |
172 | if ( m_SelectedAppIndex >= 0 ) { | 163 | if ( m_SelectedAppIndex >= 0 ) { |
173 | QString channel = QString("QPE/Application/") + m_AppList.at(m_SelectedAppIndex)->exec(); | 164 | QString channel = QString("QPE/Application/") + m_AppList.at(m_SelectedAppIndex)->exec(); |
174 | if (QCopChannel::isRegistered(channel.latin1())) { | 165 | if (QCopChannel::isRegistered(channel.latin1())) { |
175 | // qDebug("%s is running!", m_AppList.at(m_SelectedAppIndex)->exec().latin1()); | 166 | // qDebug("%s is running!", m_AppList.at(m_SelectedAppIndex)->exec().latin1()); |
176 | QCopEnvelope e(channel.latin1(), "raise()"); | 167 | QCopEnvelope e(channel.latin1(), "raise()"); |
177 | // This class will delete itself after hearing from the app or the timer expiring | 168 | // This class will delete itself after hearing from the app or the timer expiring |
178 | (void)new AppMonitor(*m_AppList.at(m_SelectedAppIndex), *this); | 169 | (void)new AppMonitor(*m_AppList.at(m_SelectedAppIndex), *this); |
179 | } | 170 | } |
180 | else { | 171 | else { |
181 | removeTask(*m_AppList.at(m_SelectedAppIndex)); | 172 | removeTask(*m_AppList.at(m_SelectedAppIndex)); |
182 | } | 173 | } |
183 | 174 | ||