static uim_bool send_knotify(const char *msg, KNotification::StandardEvent eventId) { fprintf(stderr, "%s\n", dgettext(GETTEXT_PACKAGE, msg)); if (QApplication::instance()) { KNotification::event(eventId, mygettext(msg), QPixmap(UIM_PIXMAPSDIR "/uim-icon.png")); return UIM_TRUE; } // fake arguments int argc = 1; char *arg = strdup("uim"); char *argv[] = {arg}; QApplication app(argc, argv); KNotification::event(eventId, mygettext(msg), QPixmap(UIM_PIXMAPSDIR "/uim-icon.png")); free(arg); return UIM_TRUE; }
//---------------------------------------------------------------------------------------- CustomPathnameEdit::CustomPathnameEdit( struct uim_custom *c, QWidget *parent, const char *name) : QHBox( parent, name ), UimCustomItemIface( c ) { const char *button; setSpacing( 3 ); m_lineEdit = new QLineEdit( this ); QObject::connect( m_lineEdit, SIGNAL(textChanged(const QString &)), this, SLOT(slotCustomTextChanged(const QString &)) ); m_fileButton = new QPushButton( this ); /* Since both pathname type opens the file dialog to select an item rather * than open it, the label should always be "Select..." here. The type is * obvious for uses even if the button label does not indicate * it. Information about the action the button causes is more important. * -- YamaKen 2006-01-21 */ switch (m_custom->value->as_pathname->type) { case UCustomPathnameType_Directory: button = N_( "Select..." ); break; case UCustomPathnameType_RegularFile: default: button = N_( "Select..." ); break; } m_fileButton->setText( mygettext(button) ); QObject::connect( m_fileButton, SIGNAL(clicked()), this, SLOT(slotPathnameButtonClicked()) ); update(); }
static inline QString qstring_(const QString &string) { #if ENABLE_NLS return mygettext(string.toUtf8().data()); #else return string; #endif }
void UnicodeViewWidget::setupWidgets() { m_mainSplitter = new QSplitter( this ); QFrame *leftVBox = new QFrame( m_mainSplitter ); QLabel *unicodeBlockLabel = new QLabel; unicodeBlockLabel->setText( _( "UnicodeBlock List" ) ); unicodeBlockLabel->setAlignment( Qt::AlignHCenter ); m_unicodeBlockListView = new QListWidget; m_unicodeBlockListView->setSelectionMode( QAbstractItemView::SingleSelection ); m_unicodeBlockListView->setHorizontalScrollBarPolicy( Qt::ScrollBarAlwaysOff ); connect( m_unicodeBlockListView, SIGNAL( itemSelectionChanged() ), this, SLOT( slotUnicodeBlockSelected() ) ); // add Item for ( int i = sizeof( uBlocks ) / sizeof( uBlocks[0] ) - 1; i >= 0; i-- ) { const QString uBlockName = uBlocks[ i ].getName(); QByteArray originalArray; originalArray += "chardict" GETTEXT_CONTEXT_GLUE + uBlockName.toLatin1(); const char *original = originalArray.constData(); QString translation = mygettext( original ); if ( translation == original ) translation = uBlockName; QListWidgetItem *item = new QListWidgetItem( translation ); m_unicodeBlockListView->insertItem( 0, item ); uBlockMap[ item ] = &uBlocks[ i ]; } m_charGridView = new CharGridView( 10, 0, m_mainSplitter ); connect( m_charGridView, SIGNAL( charSelected( const QString & ) ), this, SIGNAL( charSelected( const QString & ) ) ); QVBoxLayout *vLayout = new QVBoxLayout; vLayout->setMargin( 0 ); vLayout->addWidget( unicodeBlockLabel ); vLayout->addWidget( m_unicodeBlockListView ); leftVBox->setLayout( vLayout ); // main layout QHBoxLayout* layout = new QHBoxLayout( this ); layout->addWidget( m_mainSplitter ); }
void UnicodeViewWidget::setupWidgets() { m_mainSplitter = new QSplitter( this ); QVBox *leftVBox = new QVBox( m_mainSplitter ); QLabel *unicodeBlockLabel = new QLabel( leftVBox ); unicodeBlockLabel->setText( _( "UnicodeBlock List" ) ); unicodeBlockLabel->setAlignment( Qt::AlignHCenter ); m_unicodeBlockListView = new QListView( leftVBox ); m_unicodeBlockListView->setSorting( -1 ); m_unicodeBlockListView->setSelectionMode( QListView::Single ); m_unicodeBlockListView->addColumn( "0" ); m_unicodeBlockListView->header() ->setStretchEnabled( true, 0 ); m_unicodeBlockListView->header() ->hide(); m_unicodeBlockListView->setColumnWidthMode( 1, QListView::Maximum ); m_unicodeBlockListView->setHScrollBarMode( QScrollView::AlwaysOff ); m_unicodeBlockListView->setAllColumnsShowFocus( true ); QObject::connect( m_unicodeBlockListView, SIGNAL( selectionChanged( QListViewItem * ) ), this, SLOT( slotUnicodeBlockSelected( QListViewItem * ) ) ); // add Item for ( int i = sizeof( uBlocks ) / sizeof ( uBlocks[0] ); i >= 0; i-- ) { const QString uBlockName = uBlocks[ i ].getName(); QString originalStr; originalStr += "chardict" GETTEXT_CONTEXT_GLUE + uBlockName; const char *original = originalStr; QString translation = mygettext( original ); if ( translation == original ) translation = uBlockName; QListViewItem *item = new QListViewItem( m_unicodeBlockListView, translation ); uBlockMap[ item ] = &uBlocks[ i ]; } m_charGridView = new CharGridView( 10, 0, m_mainSplitter ); QObject::connect( m_charGridView, SIGNAL( charSelected( const QString & ) ), this, SIGNAL( charSelected( const QString & ) ) ); // main layout QHBoxLayout* layout = new QHBoxLayout( this ); layout->addWidget( m_mainSplitter ); }