• Skip to content
  • Skip to link menu
Trinity API Reference
  • Trinity API Reference
  • tdecore
 

tdecore

  • tdecore
tdeshortcut.cpp
1 /* This file is part of the KDE libraries
2  Copyright (C) 2001,2002 Ellis Whitehead <ellis@kde.org>
3 
4  This library is free software; you can redistribute it and/or
5  modify it under the terms of the GNU Library General Public
6  License as published by the Free Software Foundation; either
7  version 2 of the License, or (at your option) any later version.
8 
9  This library is distributed in the hope that it will be useful,
10  but WITHOUT ANY WARRANTY; without even the implied warranty of
11  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12  Library General Public License for more details.
13 
14  You should have received a copy of the GNU Library General Public License
15  along with this library; see the file COPYING.LIB. If not, write to
16  the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
17  Boston, MA 02110-1301, USA.
18 */
19 
20 #include "tdeshortcut.h"
21 #include "kkeynative.h"
22 #include "kkeyserver.h"
23 
24 #include <tqevent.h>
25 #include <tqstringlist.h>
26 
27 #include <kdebug.h>
28 #include <tdeglobal.h>
29 #include <tdelocale.h>
30 #include <ksimpleconfig.h>
31 
32 //----------------------------------------------------
33 
34 static KKey* g_pspec = 0;
35 static KKeySequence* g_pseq = 0;
36 static TDEShortcut* g_pcut = 0;
37 
38 //----------------------------------------------------
39 // KKey
40 //----------------------------------------------------
41 
42 KKey::KKey() { clear(); }
43 KKey::KKey( uint key, uint modFlags ) { init( key, modFlags ); }
44 KKey::KKey( int keyQt ) { init( keyQt ); }
45 KKey::KKey( const TQKeySequence& seq ) { init( seq ); }
46 KKey::KKey( const TQKeyEvent* pEvent ) { init( pEvent ); }
47 KKey::KKey( const KKey& key ) { init( key ); }
48 KKey::KKey( const TQString& sKey ) { init( sKey ); }
49 
50 KKey::~KKey()
51 {
52 }
53 
54 void KKey::clear()
55 {
56  m_sym = 0;
57  m_mod = 0;
58 }
59 
60 bool KKey::init( uint key, uint modFlags )
61 {
62  m_sym = key;
63  m_mod = modFlags;
64  return true;
65 }
66 
67 bool KKey::init( int keyQt )
68 {
69  //KKeyServer::Sym sym;
70 
71  //if( sym.initQt( keyQt )
72  if( KKeyServer::keyQtToSym( keyQt, m_sym )
73  && KKeyServer::keyQtToMod( keyQt, m_mod ) ) {
74  return true;
75  }
76  else {
77  m_sym = 0;
78  m_mod = 0;
79  return false;
80  }
81 }
82 
83 bool KKey::init( const TQKeySequence& key )
84 {
85  // TODO: if key.count() > 1, should we return failure?
86  return init( (int) key );
87 }
88 
89 bool KKey::init( const TQKeyEvent* pEvent )
90 {
91  int keyQt = pEvent->key();
92  if( pEvent->state() & TQt::ShiftButton ) keyQt |= Qt::SHIFT;
93  if( pEvent->state() & TQt::ControlButton ) keyQt |= Qt::CTRL;
94  if( pEvent->state() & TQt::AltButton ) keyQt |= Qt::ALT;
95  if( pEvent->state() & TQt::MetaButton ) keyQt |= Qt::META;
96  return init( keyQt );
97 }
98 
99 bool KKey::init( const KKey& key )
100 {
101  m_sym = key.m_sym;
102  m_mod = key.m_mod;
103  return true;
104 }
105 
106 bool KKey::init( const TQString& sSpec )
107 {
108  clear();
109 
110  TQString sKey = sSpec.stripWhiteSpace();
111  if( sKey.startsWith( "default(" ) && sKey.endsWith( ")" ) )
112  sKey = sKey.mid( 8, sKey.length() - 9 );
113  // i.e., "Ctrl++" = "Ctrl+Plus"
114  if( sKey.endsWith( "++" ) )
115  sKey = sKey.left( sKey.length() - 1 ) + "plus";
116  TQStringList rgs = TQStringList::split( '+', sKey, true );
117 
118  uint i;
119  // Check for modifier keys first.
120  for( i = 0; i < rgs.size(); i++ ) {
121  TQString s = rgs[i].lower();
122  if( s == "shift" ) m_mod |= KKey::SHIFT;
123  else if( s == "ctrl" ) m_mod |= KKey::CTRL;
124  else if( s == "alt" ) m_mod |= KKey::ALT;
125  else if( s == "win" ) m_mod |= KKey::WIN;
126  else if( s == "meta" ) m_mod |= KKey::WIN;
127  else {
128  uint m = KKeyServer::stringUserToMod( s );
129  if( m != 0 ) m_mod |= m;
130  else break;
131  }
132  }
133  // If there is one non-blank key left:
134  if( (i == rgs.size() - 1 && !rgs[i].isEmpty()) ) {
135  KKeyServer::Sym sym( rgs[i] );
136  m_sym = sym.m_sym;
137  }
138 
139  if( m_sym == 0 )
140  m_mod = 0;
141 
142  kdDebug(125) << "KKey::init( \"" << sSpec << "\" ):"
143  << " m_sym = " << TQString::number(m_sym, 16)
144  << ", m_mod = " << TQString::number(m_mod, 16) << endl;
145 
146  return m_sym != 0;
147 }
148 
149 bool KKey::isNull() const { return m_sym == 0; }
150 uint KKey::sym() const { return m_sym; }
151 uint KKey::modFlags() const { return m_mod; }
152 
153 int KKey::compare( const KKey& spec ) const
154 {
155  if( m_sym != spec.m_sym )
156  return m_sym - spec.m_sym;
157  if( m_mod != spec.m_mod )
158  return m_mod - spec.m_mod;
159  return 0;
160 }
161 
162 int KKey::keyCodeQt() const
163 {
164  return KKeyNative( *this ).keyCodeQt();
165 }
166 
167 TQString KKey::toString() const
168 {
169  TQString s;
170 
171  s = KKeyServer::modToStringUser( m_mod );
172  if( !s.isEmpty() )
173  s += '+';
174  s += KKeyServer::Sym(m_sym).toString();
175 
176  return s;
177 }
178 
179 TQString KKey::toStringInternal() const
180 {
181  //kdDebug(125) << "KKey::toStringInternal(): this = " << this
182  // << " mod = " << TQString::number(m_mod, 16)
183  // << " key = " << TQString::number(m_sym, 16) << endl;
184  TQString s;
185 
186  s = KKeyServer::modToStringInternal( m_mod );
187  if( !s.isEmpty() )
188  s += '+';
189  s += KKeyServer::Sym(m_sym).toStringInternal();
190  return s;
191 }
192 
193 KKey& KKey::null()
194 {
195  if( !g_pspec )
196  g_pspec = new KKey;
197  if( !g_pspec->isNull() )
198  g_pspec->clear();
199  return *g_pspec;
200 }
201 
202 TQString KKey::modFlagLabel( ModFlag modFlag )
203 {
204  return KKeyServer::modToStringUser( modFlag );
205 }
206 
207 //---------------------------------------------------------------------
208 // KKeySequence
209 //---------------------------------------------------------------------
210 
211 KKeySequence::KKeySequence() { clear(); }
212 KKeySequence::KKeySequence( const TQKeySequence& seq ) { init( seq ); }
213 KKeySequence::KKeySequence( const KKey& key ) { init( key ); }
214 KKeySequence::KKeySequence( const KKeySequence& seq ) { init( seq ); }
215 KKeySequence::KKeySequence( const TQString& s ) { init( s ); }
216 
217 KKeySequence::~KKeySequence()
218 {
219 }
220 
221 void KKeySequence::clear()
222 {
223  m_nKeys = 0;
224  m_bTriggerOnRelease = false;
225 }
226 
227 bool KKeySequence::init( const TQKeySequence& seq )
228 {
229  clear();
230  if( !seq.isEmpty() ) {
231  for( uint i = 0; i < seq.count(); i++ ) {
232  m_rgvar[i].init( seq[i] );
233  if( m_rgvar[i].isNull() )
234  return false;
235  }
236  m_nKeys = seq.count();
237  m_bTriggerOnRelease = false;
238  }
239  return true;
240 }
241 
242 bool KKeySequence::init( const KKey& key )
243 {
244  if( !key.isNull() ) {
245  m_nKeys = 1;
246  m_rgvar[0].init( key );
247  m_bTriggerOnRelease = false;
248  } else
249  clear();
250  return true;
251 }
252 
253 bool KKeySequence::init( const KKeySequence& seq )
254 {
255  m_bTriggerOnRelease = false;
256  m_nKeys = seq.m_nKeys;
257  for( uint i = 0; i < m_nKeys; i++ ) {
258  if( seq.m_rgvar[i].isNull() ) {
259  kdDebug(125) << "KKeySequence::init( seq ): key[" << i << "] is null." << endl;
260  m_nKeys = 0;
261  return false;
262  }
263  m_rgvar[i] = seq.m_rgvar[i];
264  }
265  return true;
266 }
267 
268 bool KKeySequence::init( const TQString& s )
269 {
270  m_bTriggerOnRelease = false;
271  //kdDebug(125) << "KKeySequence::init( " << s << " )" << endl;
272  TQStringList rgs = TQStringList::split( ',', s );
273  if( s == "none" || rgs.size() == 0 ) {
274  clear();
275  return true;
276  } else if( rgs.size() <= MAX_KEYS ) {
277  m_nKeys = rgs.size();
278  for( uint i = 0; i < m_nKeys; i++ ) {
279  m_rgvar[i].init( KKey(rgs[i]) );
280  //kdDebug(125) << "\t'" << rgs[i] << "' => " << m_rgvar[i].toStringInternal() << endl;
281  }
282  return true;
283  } else {
284  clear();
285  return false;
286  }
287 }
288 
289 uint KKeySequence::count() const
290 {
291  return m_nKeys;
292 }
293 
294 const KKey& KKeySequence::key( uint i ) const
295 {
296  if( i < m_nKeys )
297  return m_rgvar[i];
298  else
299  return KKey::null();
300 }
301 
302 bool KKeySequence::isTriggerOnRelease() const
303  { return m_bTriggerOnRelease; }
304 
305 bool KKeySequence::setKey( uint iKey, const KKey& key )
306 {
307  if( iKey <= m_nKeys && iKey < MAX_KEYS ) {
308  m_rgvar[iKey].init( key );
309  if( iKey == m_nKeys )
310  m_nKeys++;
311  return true;
312  } else
313  return false;
314 }
315 
316 bool KKeySequence::isNull() const
317 {
318  return m_nKeys == 0;
319 }
320 
321 bool KKeySequence::startsWith( const KKeySequence& seq ) const
322 {
323  if( m_nKeys < seq.m_nKeys )
324  return false;
325 
326  for( uint i = 0; i < seq.m_nKeys; i++ ) {
327  if( m_rgvar[i] != seq.m_rgvar[i] )
328  return false;
329  }
330 
331  return true;
332 }
333 
334 int KKeySequence::compare( const KKeySequence& seq ) const
335 {
336  for( uint i = 0; i < m_nKeys && i < seq.m_nKeys; i++ ) {
337  int ret = m_rgvar[i].compare( seq.m_rgvar[i] );
338  if( ret != 0 )
339  return ret;
340  }
341  if( m_nKeys != seq.m_nKeys )
342  return m_nKeys - seq.m_nKeys;
343  else
344  return 0;
345 }
346 
347 TQKeySequence KKeySequence::qt() const
348 {
349  int k[4] = { 0, 0, 0, 0 };
350 
351  for( uint i = 0; i < count(); i++ )
352  k[i] = KKeyNative(key(i)).keyCodeQt();
353  TQKeySequence seq( k[0], k[1], k[2], k[3] );
354  return seq;
355 }
356 
357 int KKeySequence::keyCodeQt() const
358 {
359  return (count() == 1) ? KKeyNative(key(0)).keyCodeQt() : 0;
360 }
361 
362 TQString KKeySequence::toString() const
363 {
364  if( m_nKeys < 1 ) return TQString::null;
365 
366  TQString s;
367  s = m_rgvar[0].toString();
368  for( uint i = 1; i < m_nKeys; i++ ) {
369  s += ",";
370  s += m_rgvar[i].toString();
371  }
372 
373  return s;
374 }
375 
376 TQString KKeySequence::toStringInternal() const
377 {
378  if( m_nKeys < 1 ) return TQString::null;
379 
380  TQString s;
381  s = m_rgvar[0].toStringInternal();
382  for( uint i = 1; i < m_nKeys; i++ ) {
383  s += ",";
384  s += m_rgvar[i].toStringInternal();
385  }
386 
387  return s;
388 }
389 
390 KKeySequence& KKeySequence::null()
391 {
392  if( !g_pseq )
393  g_pseq = new KKeySequence;
394  if( !g_pseq->isNull() )
395  g_pseq->clear();
396  return *g_pseq;
397 }
398 
399 //---------------------------------------------------------------------
400 // TDEShortcut
401 //---------------------------------------------------------------------
402 
403 TDEShortcut::TDEShortcut() { clear(); }
404 TDEShortcut::TDEShortcut( int keyQt ) { init( keyQt ); }
405 TDEShortcut::TDEShortcut( const TQKeySequence& key ) { init( key ); }
406 TDEShortcut::TDEShortcut( const KKey& key ) { init( key ); }
407 TDEShortcut::TDEShortcut( const KKeySequence& seq ) { init( seq ); }
408 TDEShortcut::TDEShortcut( const TDEShortcut& cut ) { init( cut ); }
409 TDEShortcut::TDEShortcut( const char* ps ) { init( TQString(ps) ); }
410 TDEShortcut::TDEShortcut( const TQString& s ) { init( s ); }
411 
412 TDEShortcut::~TDEShortcut()
413 {
414 }
415 
416 void TDEShortcut::clear()
417 {
418  m_nSeqs = 0;
419 }
420 
421 bool TDEShortcut::init( int keyQt )
422 {
423  if( keyQt ) {
424  m_nSeqs = 1;
425  m_rgseq[0].init( TQKeySequence(keyQt) );
426  }
427  else {
428  clear();
429  }
430  return true;
431 }
432 
433 bool TDEShortcut::init( const TQKeySequence& key )
434 {
435  m_nSeqs = 1;
436  m_rgseq[0].init( key );
437  return true;
438 }
439 
440 bool TDEShortcut::init( const KKey& spec )
441 {
442  m_nSeqs = 1;
443  m_rgseq[0].init( spec );
444  return true;
445 }
446 
447 bool TDEShortcut::init( const KKeySequence& seq )
448 {
449  m_nSeqs = 1;
450  m_rgseq[0] = seq;
451  return true;
452 }
453 
454 bool TDEShortcut::init( const TDEShortcut& cut )
455 {
456  m_nSeqs = cut.m_nSeqs;
457  for( uint i = 0; i < m_nSeqs; i++ )
458  m_rgseq[i] = cut.m_rgseq[i];
459  return true;
460 }
461 
462 bool TDEShortcut::init( const TQString& s )
463 {
464  bool bRet = true;
465  TQStringList rgs = TQStringList::split( ';', s );
466 
467  if( s == "none" || rgs.size() == 0 )
468  clear();
469  else if( rgs.size() <= MAX_SEQUENCES ) {
470  m_nSeqs = rgs.size();
471  for( uint i = 0; i < m_nSeqs; i++ ) {
472  TQString& sSeq = rgs[i];
473  if( sSeq.startsWith( "default(" ) )
474  sSeq = sSeq.mid( 8, sSeq.length() - 9 );
475  m_rgseq[i].init( sSeq );
476  //kdDebug(125) << "*\t'" << sSeq << "' => " << m_rgseq[i].toStringInternal() << endl;
477  }
478  } else {
479  clear();
480  bRet = false;
481  }
482 
483  if( !s.isEmpty() ) {
484  TQString sDebug;
485  TQTextStream os( &sDebug, IO_WriteOnly );
486  os << "TDEShortcut::init( \"" << s << "\" ): ";
487  for( uint i = 0; i < m_nSeqs; i++ ) {
488  os << " m_rgseq[" << i << "]: ";
489  KKeyServer::Variations vars;
490  vars.init( m_rgseq[i].key(0), true );
491  for( uint j = 0; j < vars.count(); j++ )
492  os << TQString::number(vars.m_rgkey[j].keyCodeQt(),16) << ',';
493  }
494  kdDebug(125) << sDebug << endl;
495  }
496 
497  return bRet;
498 }
499 
500 uint TDEShortcut::count() const
501 {
502  return m_nSeqs;
503 }
504 
505 const KKeySequence& TDEShortcut::seq( uint i ) const
506 {
507  return (i < m_nSeqs) ? m_rgseq[i] : KKeySequence::null();
508 }
509 
510 int TDEShortcut::keyCodeQt() const
511 {
512  if( m_nSeqs >= 1 )
513  return m_rgseq[0].keyCodeQt();
514  return TQKeySequence();
515 }
516 
517 bool TDEShortcut::isNull() const
518 {
519  return m_nSeqs == 0;
520 }
521 
522 int TDEShortcut::compare( const TDEShortcut& cut ) const
523 {
524  for( uint i = 0; i < m_nSeqs && i < cut.m_nSeqs; i++ ) {
525  int ret = m_rgseq[i].compare( cut.m_rgseq[i] );
526  if( ret != 0 )
527  return ret;
528  }
529  return m_nSeqs - cut.m_nSeqs;
530 }
531 
532 bool TDEShortcut::contains( const KKey& key ) const
533 {
534  return contains( KKeySequence(key) );
535 }
536 
537 bool TDEShortcut::contains( const KKeyNative& keyNative ) const
538 {
539  KKey key = keyNative.key();
540  key.simplify();
541 
542  for( uint i = 0; i < count(); i++ ) {
543  if( !m_rgseq[i].isNull()
544  && m_rgseq[i].count() == 1
545  && m_rgseq[i].key(0) == key )
546  return true;
547  }
548  return false;
549 }
550 
551 bool TDEShortcut::contains( const KKeySequence& seq ) const
552 {
553  for( uint i = 0; i < count(); i++ ) {
554  if( !m_rgseq[i].isNull() && m_rgseq[i] == seq )
555  return true;
556  }
557  return false;
558 }
559 
560 bool TDEShortcut::setSeq( uint iSeq, const KKeySequence& seq )
561 {
562  // TODO: check if seq is null, and act accordingly.
563  if( iSeq <= m_nSeqs && iSeq < MAX_SEQUENCES ) {
564  m_rgseq[iSeq] = seq;
565  if( iSeq == m_nSeqs )
566  m_nSeqs++;
567  return true;
568  } else
569  return false;
570 }
571 
572 void TDEShortcut::remove( const KKeySequence& seq )
573 {
574  if (seq.isNull()) return;
575 
576  for( uint iSeq = 0; iSeq < m_nSeqs; iSeq++ )
577  {
578  if (m_rgseq[iSeq] == seq)
579  {
580  for( uint jSeq = iSeq + 1; jSeq < m_nSeqs; jSeq++)
581  m_rgseq[jSeq-1] = m_rgseq[jSeq];
582  m_nSeqs--;
583  }
584  }
585 }
586 
587 bool TDEShortcut::append( const KKeySequence& seq )
588 {
589  if( m_nSeqs < MAX_SEQUENCES ) {
590  if( !seq.isNull() ) {
591  m_rgseq[m_nSeqs] = seq;
592  m_nSeqs++;
593  }
594  return true;
595  } else
596  return false;
597 }
598 
599 bool TDEShortcut::append( const KKey& spec )
600 {
601  if( m_nSeqs < MAX_SEQUENCES ) {
602  m_rgseq[m_nSeqs].init( spec );
603  m_nSeqs++;
604  return true;
605  } else
606  return false;
607 }
608 
609 bool TDEShortcut::append( const TDEShortcut& cut )
610 {
611  uint seqs = m_nSeqs, co = cut.count();
612  for( uint i=0; i<co; i++ ) {
613  if (!contains(cut.seq(i))) seqs++;
614  }
615  if( seqs > MAX_SEQUENCES ) return false;
616 
617  for( uint i=0; i<co; i++ ) {
618  const KKeySequence& seq = cut.seq(i);
619  if(!contains(seq)) {
620  m_rgseq[m_nSeqs] = seq;
621  m_nSeqs++;
622  }
623  }
624  return true;
625 }
626 
627 TDEShortcut::operator TQKeySequence () const
628 {
629  if( count() >= 1 )
630  return m_rgseq[0].qt();
631  else
632  return TQKeySequence();
633 }
634 
635 TQString TDEShortcut::toString() const
636 {
637  TQString s;
638 
639  for( uint i = 0; i < count(); i++ ) {
640  s += m_rgseq[i].toString();
641  if( i < count() - 1 )
642  s += ';';
643  }
644 
645  return s;
646 }
647 
648 TQString TDEShortcut::toStringInternal( const TDEShortcut* pcutDefault ) const
649 {
650  TQString s;
651 
652  for( uint i = 0; i < count(); i++ ) {
653  const KKeySequence& seq = m_rgseq[i];
654  if( pcutDefault && i < pcutDefault->count() && seq == (*pcutDefault).seq(i) ) {
655  s += "default(";
656  s += seq.toStringInternal();
657  s += ")";
658  } else
659  s += seq.toStringInternal();
660  if( i < count() - 1 )
661  s += ';';
662  }
663 
664  return s;
665 }
666 
667 TDEShortcut& TDEShortcut::null()
668 {
669  if( !g_pcut )
670  g_pcut = new TDEShortcut;
671  if( !g_pcut->isNull() )
672  g_pcut->clear();
673  return *g_pcut;
674 }
KKey::ModFlag
ModFlag
Flags to represent the modifiers.
Definition: tdeshortcut.h:53
KKeyServer::Sym
Represents a key symbol.
Definition: kkeyserver_x11.h:47
KKey::KKey
KKey()
Creates a new null KKey.
Definition: tdeshortcut.cpp:42
TDEShortcut::seq
const KKeySequence & seq(uint i) const
Returns the i'th key sequence of this shortcut.
Definition: tdeshortcut.cpp:505
KKey::null
static KKey & null()
Returns a null key.
Definition: tdeshortcut.cpp:193
KKeySequence::compare
int compare(const KKeySequence &keySeq) const
Compares this object with the given key sequence.
Definition: tdeshortcut.cpp:334
KKeySequence::setKey
bool setKey(uint i, const KKey &key)
Sets the i'th key of the sequence.
Definition: tdeshortcut.cpp:305
KKeyServer::Key::keyCodeQt
int keyCodeQt() const
Returns the qt key code.
Definition: kkeyserver_x11.h:192
KKeySequence::clear
void clear()
Clears the key sequence.
Definition: tdeshortcut.cpp:221
TDEShortcut::contains
bool contains(const KKey &key) const
Checks whether this shortcut contains a sequence that starts with the given key.
Definition: tdeshortcut.cpp:532
KKeyNative::key
KKey key() const
Returns the KKey representation of this key.
KKeySequence::qt
TQKeySequence qt() const
Converts this key sequence to a TQKeySequence.
Definition: tdeshortcut.cpp:347
KKeySequence::keyCodeQt
int keyCodeQt() const
Returns the qt key code of the first key.
Definition: tdeshortcut.cpp:357
TDEShortcut::isNull
bool isNull() const
Returns true if the shortcut is null (after clear() or empty constructor).
Definition: tdeshortcut.cpp:517
TDEShortcut::keyCodeQt
int keyCodeQt() const
Returns the key code of the first key sequence, or null if there is no first key sequence.
Definition: tdeshortcut.cpp:510
TDEShortcut::count
uint count() const
Returns the number of sequences that are in this shortcut.
Definition: tdeshortcut.cpp:500
KKey::toString
TQString toString() const
Returns a human-readable representation of the key in the form "modifier+key".
Definition: tdeshortcut.cpp:167
KKeyServer::Variations
TODO: please document this class.
Definition: kkeyserver_x11.h:244
KKeySequence::init
bool init(const TQKeySequence &keySeq)
Copies the given qt key sequence over this key sequence.
Definition: tdeshortcut.cpp:227
KKeyServer::Sym::toString
TQString toString() const
Returns the string representation of the symbol.
KKey::isNull
bool isNull() const
Returns true if the key is null (after clear() or empty constructor).
Definition: tdeshortcut.cpp:149
KKey::init
bool init(int keyQt)
Initializes the key with the given Qt key code.
Definition: tdeshortcut.cpp:67
KKeySequence
A KKeySequence object holds a sequence of up to 4 keys.
Definition: tdeshortcut.h:288
KKeyServer::keyQtToMod
bool keyQtToMod(int keyQt, uint &mod)
Extracts the modifiers from the given Qt key and converts them in a mask of ORed KKey::ModFlag modifi...
KKeyNative::keyCodeQt
int keyCodeQt() const
Returns the qt key code.
KKey::clear
void clear()
Clears the key.
Definition: tdeshortcut.cpp:54
KKeySequence::startsWith
bool startsWith(const KKeySequence &keySeq) const
Returns true if this key sequence begins with the given sequence.
Definition: tdeshortcut.cpp:321
tdelocale.h
TDEShortcut::compare
int compare(const TDEShortcut &shortcut) const
Compares this object with the given shortcut.
Definition: tdeshortcut.cpp:522
KKeyServer::Sym::m_sym
uint m_sym
the actual value of the symbol
Definition: kkeyserver_x11.h:51
KKeySequence::key
const KKey & key(uint i) const
Return the i'th key of this sequence, or a null key if there are less then i keys.
Definition: tdeshortcut.cpp:294
KKeySequence::null
static KKeySequence & null()
Returns a null key sequence.
Definition: tdeshortcut.cpp:390
KKeySequence::KKeySequence
KKeySequence()
Create a new null key sequence.
Definition: tdeshortcut.cpp:211
KKeySequence::toString
TQString toString() const
Returns the key sequence as a number of key presses as returned by KKey::toString(), separated by commas.
Definition: tdeshortcut.cpp:362
KKeyNative
Representation of a key in the format native of the windowing system (eg.
Definition: kkeynative.h:37
TDEShortcut::toString
TQString toString() const
Returns a description of the shortcut as semicolon-separated ket sequences, as returned by KKeySequen...
Definition: tdeshortcut.cpp:635
TDEShortcut::setSeq
bool setSeq(uint i, const KKeySequence &keySeq)
Sets the i 'th key sequence of the shortcut.
Definition: tdeshortcut.cpp:560
KKeyServer::stringUserToMod
uint stringUserToMod(const TQString &mod)
Converts the modifier given as user-readable string to KKey::ModFlag modifier, or 0...
KKeyServer::modToStringUser
TQString modToStringUser(uint mod)
Converts the mask of ORed KKey::ModFlag modifiers to a user-readable string.
KKey
A KKey object represents a single key with possible modifiers (Shift, Ctrl, Alt, Win).
Definition: tdeshortcut.h:40
TDEShortcut
The TDEShortcut class is used to represent a keyboard shortcut to an action.
Definition: tdeshortcut.h:543
KKey::toStringInternal
TQString toStringInternal() const
Returns an untranslated text representation of the key in the form "modifier+key", suitable e.g.
Definition: tdeshortcut.cpp:179
KKey::keyCodeQt
int keyCodeQt() const
Returns the qt key code.
Definition: tdeshortcut.cpp:162
TDEShortcut::null
static TDEShortcut & null()
Returns a null shortcut.
Definition: tdeshortcut.cpp:667
TDEShortcut::append
bool append(const KKeySequence &keySeq)
Appends the given key sequence.
Definition: tdeshortcut.cpp:587
KKey::modFlagLabel
static TQString modFlagLabel(ModFlag f)
Returns a user-readable representation of the given modifiers.
Definition: tdeshortcut.cpp:202
TDEShortcut::TDEShortcut
TDEShortcut()
Creates a new null shortcut.
Definition: tdeshortcut.cpp:403
endl
kndbgstream & endl(kndbgstream &s)
Does nothing.
Definition: kdebug.h:583
KKeySequence::isNull
bool isNull() const
Returns true if the key sequence is null (after clear() or empty constructor).
Definition: tdeshortcut.cpp:316
TDEShortcut::remove
void remove(const KKeySequence &keySeq)
Removes the given key sequence from this shortcut.
Definition: tdeshortcut.cpp:572
TDEShortcut::clear
void clear()
Clears the shortcut.
Definition: tdeshortcut.cpp:416
TDEShortcut::init
bool init(int keyQt)
Initializes the shortcut with the given Qt key code as the only key sequence.
Definition: tdeshortcut.cpp:421
KKey::compare
int compare(const KKey &key) const
Compares this key with the given KKey object.
Definition: tdeshortcut.cpp:153
KKeySequence::count
uint count() const
Returns the number of key strokes of this sequence.
Definition: tdeshortcut.cpp:289
KKeyServer::keyQtToSym
bool keyQtToSym(int keyQt, uint &sym)
Extracts the symbol from the given Qt key and converts it to a symbol.

tdecore

Skip menu "tdecore"
  • Main Page
  • Modules
  • Namespace List
  • Class Hierarchy
  • Alphabetical List
  • Class List
  • File List
  • Namespace Members
  • Class Members
  • Related Pages

tdecore

Skip menu "tdecore"
  • arts
  • dcop
  • dnssd
  • interfaces
  •   kspeech
  •     interface
  •     library
  •   tdetexteditor
  • kate
  • kded
  • kdoctools
  • kimgio
  • kjs
  • libtdemid
  • libtdescreensaver
  •     tdecore
  • tdeabc
  • tdecmshell
  • tdecore
  • tdefx
  • tdehtml
  • tdeinit
  • tdeio
  •   bookmarks
  •   httpfilter
  •   kpasswdserver
  •   kssl
  • tdeioslave
  •   http
  •   tdefile
  •   tdeio
  •   tdeioexec
  • tdemdi
  •   tdemdi
  • tdenewstuff
  • tdeparts
  • tdeprint
  • tderandr
  • tderesources
  • tdespell2
  • tdesu
  • tdeui
  • tdeunittest
  • tdeutils
  • tdewallet
Generated for tdecore by doxygen 1.8.8
This website is maintained by Timothy Pearson.