~ubuntu-branches/ubuntu/precise/uim/precise

« back to all changes in this revision

Viewing changes to qt4/pref/customwidgets.cpp

  • Committer: Package Import Robot
  • Author(s): Ilya Barygin
  • Date: 2011-12-18 16:35:38 UTC
  • mfrom: (1.1.13) (15.1.7 sid)
  • Revision ID: package-import@ubuntu.com-20111218163538-8ktir39z2mjpii8z
Tags: 1:1.7.1-3ubuntu1
* Merge from Debian testing (LP: #818199).
* Remaining changes:
  - debian/uim-qt.install: Fix plugin path for multiarch location.
* Dropped changes:
  - uim-applet-gnome removal (GNOME 3 applet is available)
  - 19_as-needed_compile_fix.dpatch (accepted into Debian package)
* translations.patch: add several files to POTFILE.in to prevent
  intltool-update failure.

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
1
/*
2
2
 
3
 
 Copyright (c) 2003-2009 uim Project http://code.google.com/p/uim/
 
3
 Copyright (c) 2003-2011 uim Project http://code.google.com/p/uim/
4
4
 
5
5
 All rights reserved.
6
6
 
37
37
 
38
38
#include "qtgettext.h"
39
39
 
 
40
#include <QtCore/QPointer>
40
41
#include <QtGui/QFileDialog>
41
42
#include <QtGui/QLabel>
42
43
#include <QtGui/QTreeWidget>
167
168
    Q_ASSERT( m_custom->type == UCustom_Str );
168
169
 
169
170
    free( m_custom->value->as_str );
170
 
    m_custom->value->as_str = strdup( (const char*)text.toUtf8() );
 
171
    m_custom->value->as_str = strdup( text.toUtf8().data() );
171
172
 
172
173
    setCustom( m_custom );
173
174
}
203
204
                      this, SLOT(slotPathnameButtonClicked()) );
204
205
 
205
206
    QHBoxLayout *layout = new QHBoxLayout;
 
207
    layout->setMargin( 0 );
206
208
    layout->setSpacing( 3 );
207
209
    layout->addWidget( m_lineEdit );
208
210
    layout->addWidget( m_fileButton );
259
261
    Q_ASSERT( m_custom->type == UCustom_Pathname );
260
262
 
261
263
    free( m_custom->value->as_pathname->str );
262
 
    m_custom->value->as_pathname->str = strdup( (const char*)text.toUtf8() );
 
264
    m_custom->value->as_pathname->str = strdup( text.toUtf8().data() );
263
265
 
264
266
    setCustom( m_custom );
265
267
}
359
361
                      this, SLOT(slotEditButtonClicked()) );
360
362
 
361
363
    QHBoxLayout *layout = new QHBoxLayout;
 
364
    layout->setMargin( 0 );
362
365
    layout->setSpacing( 3 );
363
366
    layout->addWidget( m_lineEdit );
364
367
    layout->addWidget( m_editButton );
638
641
                      this, SLOT(slotKeyButtonClicked()) );
639
642
 
640
643
    QHBoxLayout *layout = new QHBoxLayout;
 
644
    layout->setMargin( 0 );
641
645
    layout->setSpacing( 3 );
642
646
    layout->addWidget( m_lineEdit );
643
647
    layout->addWidget( m_editButton );
763
767
 
764
768
        for( int i = 0; i < num; i++ )
765
769
        {
766
 
            const char *keystr = (const char *)keyStrList[i].toAscii();
 
770
            const char *keystr = keyStrList[i].toAscii().data();
767
771
 
768
772
            struct uim_custom_key *item = (struct uim_custom_key *)malloc(sizeof(struct uim_custom_key));
769
773
            item->type        = UCustomKey_Regular;
825
829
 
826
830
void KeyEditForm::slotAddClicked()
827
831
{
828
 
    KeyGrabDialog *d = new KeyGrabDialog( this );
 
832
    QPointer<KeyGrabDialog> d = new KeyGrabDialog( this );
829
833
    if( d->exec() == KeyGrabDialog::Accepted )
830
834
    {
831
835
        QString keystr = d->getKeyStr();
852
856
    QList<QTreeWidgetItem *> selectedItems = m_listView->selectedItems();
853
857
    if( selectedItems.isEmpty() )
854
858
        return;
855
 
    KeyGrabDialog *d = new KeyGrabDialog( this );
 
859
    QPointer<KeyGrabDialog> d = new KeyGrabDialog( this );
856
860
    if( d->exec() == KeyGrabDialog::Accepted )
857
861
    {
858
862
        QString keystr = d->getKeyStr();
883
887
    : QDialog( parent ),
884
888
      pressed_keyval( 0 ),
885
889
      pressed_keystate( Qt::NoModifier ),
886
 
      pressed_unichar ( 0 ),
887
 
      m_keystr( 0 )
 
890
      pressed_unichar ( 0 )
888
891
{
889
892
    QLabel *l = new QLabel( _("Press keys to grab (e.g. <Control>a)"), this );
890
893
 
901
904
    pressed_unichar = e->text().at(0);
902
905
}
903
906
 
904
 
void KeyGrabDialog::keyReleaseEvent( QKeyEvent * /* e */ )
 
907
void KeyGrabDialog::keyReleaseEvent( QKeyEvent *e )
905
908
{
 
909
    Q_UNUSED( e )
906
910
    // create keystr
907
911
    setKeyStr();
908
912
 
977
981
    case Qt::Key_End:
978
982
        keystr += "end";
979
983
        break;
980
 
#ifdef QT_IMMODULE
 
984
#ifdef QT4_IMMODULE
981
985
    case Qt::Key_Multi_key:
982
986
        keystr += "Multi_key";
983
987
        break;
1134
1138
    case Qt::Key_Dead_Horn:
1135
1139
        keystr += "dead-horn";
1136
1140
        break;
1137
 
#endif /* Def: QT_IMMODULE */
 
1141
#endif /* Def: QT4_IMMODULE */
1138
1142
    case Qt::Key_Shift:
1139
1143
        keystr += "Shift_key";
1140
1144
        break;